private static boolean dir_fnmatch(ByteList pattern, ByteList path, int flags) { return org.jruby.util.Dir.fnmatch(pattern.getUnsafeBytes(), pattern.getBegin(), pattern.getBegin()+pattern.getRealSize(), path.getUnsafeBytes(), path.getBegin(), path.getBegin()+path.getRealSize(), flags) == 0; }
private static boolean dir_fnmatch(ByteList pattern, ByteList path, int flags) { return org.jruby.util.Dir.fnmatch(pattern.getUnsafeBytes(), pattern.getBegin(), pattern.getBegin()+pattern.getRealSize(), path.getUnsafeBytes(), path.getBegin(), path.getBegin()+path.getRealSize(), flags) == 0; }
while(s < send) { if((c == '?' || c == '[' || Character.toLowerCase((char) string[s]) == test) && fnmatch(bytes, pat, pend, string, s, send, flags | FNM_DOTMATCH) == 0) { return 0; } else if((pathname && isdirsep(string[s]))) {
while(s < send) { if((c == '?' || c == '[' || Character.toLowerCase((char) string[s]) == test) && fnmatch(bytes, pat, pend, string, s, send, flags | FNM_DOTMATCH) == 0) { return 0; } else if((pathname && isdirsep(string[s]))) {
while(s < send) { if((c == '?' || c == '[' || Character.toLowerCase((char) string[s]) == test) && fnmatch(bytes, pat, pend, string, s, send, flags | FNM_DOTMATCH) == 0) { return 0; } else if((pathname && isdirsep(string[s]))) {
while(s < send) { if((c == '?' || c == '[' || Character.toLowerCase((char) string[s]) == test) && fnmatch(bytes, pat, pend, string, s, send, flags | FNM_DOTMATCH) == 0) { return 0; } else if((pathname && isdirsep(string[s]))) {
if(recursive) { byte[] bs = getBytesInUTF8(dirp[i]); if (fnmatch(STAR,0,1,bs,0,bs.length,flags) != 0) { continue; if(fnmatch(magic,0,magic.length,bs,0, bs.length,flags) == 0) { buf.length(0); buf.append(base); if(fnmatch(STAR,0,1,bs,0,len,flags) != 0) { continue; if(fnmatch(magic,0,magic.length,bs,0,len,flags) == 0) { buf.length(0); buf.append(base, 0, base.length - jar.length());
/** * Returns true if path matches against pattern The pattern is not a regular expression; * instead it follows rules similar to shell filename globbing. It may contain the following * metacharacters: * *: Glob - match any sequence chars (re: .*). If like begins with '.' then it doesn't. * ?: Matches a single char (re: .). * [set]: Matches a single char in a set (re: [...]). * */ @JRubyMethod(name = {"fnmatch", "fnmatch?"}, required = 2, optional = 1, meta = true) public static IRubyObject fnmatch(ThreadContext context, IRubyObject recv, IRubyObject[] args) { int flags = args.length == 3 ? RubyNumeric.num2int(args[2]) : 0; ByteList pattern = args[0].convertToString().getByteList(); ByteList path = get_path(context, args[1]).getByteList(); if (org.jruby.util.Dir.fnmatch(pattern.getUnsafeBytes(), pattern.getBegin(), pattern.getBegin()+pattern.getRealSize(), path.getUnsafeBytes(), path.getBegin(), path.getBegin()+path.getRealSize(), flags) == 0) { return context.runtime.getTrue(); } return context.runtime.getFalse(); }
/** * Returns true if path matches against pattern The pattern is not a regular expression; * instead it follows rules similar to shell filename globbing. It may contain the following * metacharacters: * *: Glob - match any sequence chars (re: .*). If like begins with '.' then it doesn't. * ?: Matches a single char (re: .). * [set]: Matches a single char in a set (re: [...]). * */ @JRubyMethod(name = {"fnmatch", "fnmatch?"}, required = 2, optional = 1, meta = true) public static IRubyObject fnmatch(ThreadContext context, IRubyObject recv, IRubyObject[] args) { int flags = args.length == 3 ? RubyNumeric.num2int(args[2]) : 0; ByteList pattern = args[0].convertToString().getByteList(); ByteList path = get_path(context, args[1]).getByteList(); if (org.jruby.util.Dir.fnmatch(pattern.getUnsafeBytes(), pattern.getBegin(), pattern.getBegin()+pattern.getRealSize(), path.getUnsafeBytes(), path.getBegin(), path.getBegin()+path.getRealSize(), flags) == 0) { return context.runtime.getTrue(); } return context.runtime.getFalse(); }