Index: src/org/jruby/Ruby.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/Ruby.java,v
retrieving revision 1.67.2.3
diff -u -r1.67.2.3 Ruby.java
--- src/org/jruby/Ruby.java	6 Jan 2006 00:44:21 -0000	1.67.2.3
+++ src/org/jruby/Ruby.java	24 Jan 2006 10:57:07 -0000
@@ -86,6 +86,7 @@
 import org.jruby.runtime.load.IAutoloadMethod;
 import org.jruby.runtime.load.LoadService;
 import org.jruby.util.BuiltinScript;
+import org.jruby.util.SmartFile;
 
 /**
  * The jruby runtime.
@@ -821,7 +822,7 @@
         assert file != null : "No such file to load";
         try {
             BufferedReader source = new BufferedReader(new FileReader(file));
-            loadScript(file.getPath(), source, wrap);
+            loadScript(file.getPath().replace(File.separatorChar, '/'), source, wrap);
             source.close();
         } catch (IOException ioExcptn) {
             throw newIOErrorFromException(ioExcptn);
@@ -943,7 +944,7 @@
     }
     
     public RubyFileStat newRubyFileStat(File file) {
-    	return new RubyFileStat(this, file);
+    	return new RubyFileStat(this, new SmartFile(file.getPath()));
     }
     
     public RubyFixnum newFixnum(long value) {
Index: src/org/jruby/RubyDir.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/RubyDir.java,v
retrieving revision 1.18.2.1
diff -u -r1.18.2.1 RubyDir.java
--- src/org/jruby/RubyDir.java	2 Jan 2006 07:07:10 -0000	1.18.2.1
+++ src/org/jruby/RubyDir.java	24 Jan 2006 10:57:07 -0000
@@ -31,7 +31,6 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
@@ -40,6 +39,7 @@
 import org.jruby.runtime.CallbackFactory;
 import org.jruby.runtime.builtin.IRubyObject;
 import org.jruby.util.Glob;
+import org.jruby.util.SmartFile;
 
 /**
  * .The Ruby built-in class Dir.
@@ -49,7 +49,7 @@
 public class RubyDir extends RubyObject {
 	// What we passed to the constructor for method 'path'
     private RubyString    path;
-    protected File      dir;
+    protected SmartFile      dir;
     private   String[]  snapshot;   // snapshot of contents of directory
     private   int       pos;        // current position in directory
     private boolean isOpen = true;
@@ -117,7 +117,7 @@
         newPath.checkSafeString();
 
 // TODO: Consolidate this absolute file nonsense
-        dir = new File(newPath.getValue()).getAbsoluteFile();
+        dir = (SmartFile)new SmartFile(newPath.getValue()).getAbsoluteFile();
         if (!dir.isDirectory()) {
             dir = null;
             throw getRuntime().newErrnoENOENTError(newPath.getValue() + " is not a directory");
@@ -160,7 +160,7 @@
             path = recv.getRuntime().newString(System.getProperty("user.dir"));
         }
         
-        File directory = new File(path.toString());
+        SmartFile directory = new SmartFile(path.toString());
         
         if (!directory.isDirectory()) {
             throw recv.getRuntime().newErrnoENOENTError("No such directory");
@@ -177,7 +177,7 @@
         recv.checkArgumentCount(args, 0, 1);
         RubyString path = args.length == 1 ? 
             (RubyString) args[0].convertToString() : getHomeDirectoryPath(recv); 
-        File dir = getDir(recv.getRuntime(), path.toString(), true);
+        SmartFile dir = getDir(recv.getRuntime(), path.toString(), true);
         String realPath = null;
         String oldCwd = System.getProperty("user.dir");
     
@@ -217,7 +217,7 @@
      * be empty.
      */
     public static IRubyObject rmdir(IRubyObject recv, RubyString path) {
-        File directory = getDir(recv.getRuntime(), path.toString(), true);
+        SmartFile directory = getDir(recv.getRuntime(), path.toString(), true);
         
         if (!directory.delete()) {
             throw recv.getRuntime().newSystemCallError("No such directory");
@@ -261,7 +261,7 @@
         args[0].checkSafeString();
         String path = args[0].toString();
 
-        File newDir = getDir(recv.getRuntime(), path, false);
+        SmartFile newDir = getDir(recv.getRuntime(), path, false);
 
         return newDir.mkdir() ? RubyFixnum.zero(recv.getRuntime()) :
             RubyFixnum.one(recv.getRuntime());
@@ -371,16 +371,16 @@
      * @param   mustExist is true the directory must exist.  If false it must not.
      * @throws  IOError if <code>path</code> is not a directory.
      */
-    protected static File getDir(IRuby runtime, String path, boolean mustExist) {
-        File result = new File(path);
+    protected static SmartFile getDir(IRuby runtime, String path, boolean mustExist) {
+        SmartFile result = new SmartFile(path);
 		
         // For some reason Java 1.5.x will print correct absolute path on a created file, 
         // but it will still operate on an old user.dir when performing any action.
         // This could even happen with older Java runtimes?
         try {
-			result = result.getCanonicalFile();
+			result = (SmartFile)result.getCanonicalFile();
         } catch (IOException e) {
-            result = result.getAbsoluteFile();
+            result = (SmartFile)result.getAbsoluteFile();
         }
 
 		boolean isDirectory = result.isDirectory();
@@ -397,7 +397,7 @@
      * Returns the contents of the specified <code>directory</code> as an
      * <code>ArrayList</code> containing the names of the files as Java Strings.
      */
-    protected static List getContents(File directory) {
+    protected static List getContents(SmartFile directory) {
         String[] contents = directory.list();
         List result = new ArrayList();
 
@@ -415,7 +415,7 @@
      * Returns the contents of the specified <code>directory</code> as an
      * <code>ArrayList</code> containing the names of the files as Ruby Strings.
      */
-    protected static List getContents(File directory, IRuby runtime) {
+    protected static List getContents(SmartFile directory, IRuby runtime) {
         List result = new ArrayList();
         String[] contents = directory.list();
         for (int i=0; i<contents.length; i++) {
Index: src/org/jruby/RubyFileStat.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/RubyFileStat.java,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 RubyFileStat.java
--- src/org/jruby/RubyFileStat.java	2 Jan 2006 07:07:09 -0000	1.1.2.1
+++ src/org/jruby/RubyFileStat.java	24 Jan 2006 10:57:08 -0000
@@ -32,17 +32,16 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby;
 
-import java.io.File;
-
 import org.jruby.runtime.CallbackFactory;
 import org.jruby.runtime.builtin.IRubyObject;
+import org.jruby.util.SmartFile;
 
 /**
  * note: renamed from FileStatClass.java
  * Implements File::Stat
  */
 public class RubyFileStat extends RubyObject {
-    private File file;
+    private SmartFile file;
     private static final int READ = 222;
     private static final int WRITE = 444;
 
@@ -62,11 +61,11 @@
         return fileStatClass;
     }
 
-    protected RubyFileStat(IRuby runtime, File file) {
+    protected RubyFileStat(IRuby runtime, SmartFile file) {
         super(runtime, runtime.getClass("File").getClass("Stat"));
 		// In some versions of java changing user.dir will not get reflected in newly constructed
 		// files.  Getting the absolutefile does seem to hack around this...
-        this.file = file.getAbsoluteFile();
+        this.file = (SmartFile)file.getAbsoluteFile();
     }
 
     public RubyBoolean directory_p() {
Index: src/org/jruby/RubyFileTest.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/RubyFileTest.java,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 RubyFileTest.java
--- src/org/jruby/RubyFileTest.java	2 Jan 2006 07:07:09 -0000	1.10.2.1
+++ src/org/jruby/RubyFileTest.java	24 Jan 2006 10:57:08 -0000
@@ -30,11 +30,11 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby;
 
-import java.io.File;
 import java.io.IOException;
 
 import org.jruby.runtime.CallbackFactory;
 import org.jruby.runtime.builtin.IRubyObject;
+import org.jruby.util.SmartFile;
 
 public class RubyFileTest {
     public static RubyModule createFileTestModule(IRuby runtime) {
@@ -81,7 +81,7 @@
     }
     
     public static IRubyObject size(IRubyObject recv, RubyString filename) {
-        File file = newFile(filename);
+        SmartFile file = newFile(filename);
         
         if (!file.exists()) {
             throw recv.getRuntime().newErrnoENOENTError("No such file: " + filename.getValue());
@@ -96,24 +96,24 @@
     }
     
     public static RubyBoolean zero_p(IRubyObject recv, RubyString filename) {
-        File file = newFile(filename);
+        SmartFile file = newFile(filename);
 		
         return filename.getRuntime().newBoolean(file.exists() && file.length() == 0L);
     }
 
     public static RubyBoolean file_p(IRubyObject recv, RubyString filename) {
-        File file = newFile(filename);
+        SmartFile file = newFile(filename);
 		
         return filename.getRuntime().newBoolean(file.isFile());
     }
     
-	private static File newFile(RubyString path) {
-		File file = new File(path.getValue());
+	private static SmartFile newFile(RubyString path) {
+		SmartFile file = new SmartFile(path.getValue());
 		
 		try {
-			file = file.getCanonicalFile();
+			file = (SmartFile)file.getCanonicalFile();
 		} catch (IOException e) {
-			file = file.getAbsoluteFile();
+			file = (SmartFile)file.getAbsoluteFile();
 		}
 		
 		return file;
Index: src/org/jruby/libraries/RbConfigLibrary.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/libraries/RbConfigLibrary.java,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 RbConfigLibrary.java
--- src/org/jruby/libraries/RbConfigLibrary.java	2 Jan 2006 07:07:12 -0000	1.4.2.2
+++ src/org/jruby/libraries/RbConfigLibrary.java	24 Jan 2006 10:57:08 -0000
@@ -29,13 +29,12 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby.libraries;
 
-import java.io.File;
-
 import org.jruby.IRuby;
 import org.jruby.RubyHash;
 import org.jruby.RubyModule;
 import org.jruby.runtime.Constants;
 import org.jruby.runtime.load.Library;
+import org.jruby.util.SmartFile;
 
 public class RbConfigLibrary implements Library {
     /**
@@ -54,23 +53,23 @@
         setConfig(configHash, "TEENY", versionParts[2]);
         setConfig(configHash, "ruby_version", versionParts[0] + '.' + versionParts[1]);
 
-        setConfig(configHash, "bindir", new File(System.getProperty("jruby.home"), "bin").getAbsolutePath());
-        setConfig(configHash, "RUBY_INSTALL_NAME", System.getProperty("jruby.script"));
-        setConfig(configHash, "ruby_install_name", System.getProperty("jruby.script"));
-        setConfig(configHash, "SHELL", System.getProperty("jruby.shell"));
-        setConfig(configHash, "prefix", new File(System.getProperty("jruby.home")).getAbsolutePath());
+        setConfig(configHash, "bindir", new SmartFile(System.getProperty("jruby.home"), "bin").getAbsolutePath());
+        setConfig(configHash, "RUBY_INSTALL_NAME", System.getProperty("jruby.script").replace('\\', '/'));
+        setConfig(configHash, "ruby_install_name", System.getProperty("jruby.script").replace('\\', '/'));
+        setConfig(configHash, "SHELL", System.getProperty("jruby.shell").replace('\\', '/'));
+        setConfig(configHash, "prefix", new SmartFile(System.getProperty("jruby.home")).getAbsolutePath());
         String libdir = System.getProperty("jruby.lib");
         if (libdir == null) 
-        	libdir = new File(System.getProperty("jruby.home"), "lib").getAbsolutePath();
+        	libdir = new SmartFile(System.getProperty("jruby.home"), "lib").getAbsolutePath();
 		setConfig(configHash, "libdir", libdir);
-        setConfig(configHash, "rubylibdir", 	new File(libdir, "ruby/1.8").getAbsolutePath());
-        setConfig(configHash, "sitedir", 		new File(libdir, "ruby/site_ruby").getAbsolutePath());
-        setConfig(configHash, "sitelibdir", 	new File(libdir, "ruby/site_ruby/1.8").getAbsolutePath());
-        setConfig(configHash, "sitearchdir", 	new File(libdir, "ruby/site_ruby/1.8/java").getAbsolutePath());
+        setConfig(configHash, "rubylibdir", 	new SmartFile(libdir, "ruby/1.8").getAbsolutePath());
+        setConfig(configHash, "sitedir", 		new SmartFile(libdir, "ruby/site_ruby").getAbsolutePath());
+        setConfig(configHash, "sitelibdir", 	new SmartFile(libdir, "ruby/site_ruby/1.8").getAbsolutePath());
+        setConfig(configHash, "sitearchdir", 	new SmartFile(libdir, "ruby/site_ruby/1.8/java").getAbsolutePath());
         setConfig(configHash, "configure_args", "");
-        setConfig(configHash, "datadir", new File(System.getProperty("jruby.home"), "share").getAbsolutePath());
-        setConfig(configHash, "mandir", new File(System.getProperty("jruby.home"), "man").getAbsolutePath());
-        setConfig(configHash, "sysconfdir", new File(System.getProperty("jruby.home"), "etc").getAbsolutePath());
+        setConfig(configHash, "datadir", new SmartFile(System.getProperty("jruby.home"), "share").getAbsolutePath());
+        setConfig(configHash, "mandir", new SmartFile(System.getProperty("jruby.home"), "man").getAbsolutePath());
+        setConfig(configHash, "sysconfdir", new SmartFile(System.getProperty("jruby.home"), "etc").getAbsolutePath());
         
         if (isWindows()) {
         	setConfig(configHash, "EXEEXT", ".exe");
Index: src/org/jruby/runtime/SelectorUtils.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/SelectorUtils.java,v
retrieving revision 1.2.2.1
diff -u -r1.2.2.1 SelectorUtils.java
--- src/org/jruby/runtime/SelectorUtils.java	2 Jan 2006 07:07:09 -0000	1.2.2.1
+++ src/org/jruby/runtime/SelectorUtils.java	24 Jan 2006 10:57:08 -0000
@@ -103,8 +103,8 @@
         // File.separator.
         // When pattern starts with a File.separator, str has to start with a
         // File.separator.
-        if (str.startsWith(File.separator)
-                != pattern.startsWith(File.separator)) {
+        if (str.startsWith("/")
+                != pattern.startsWith("/")) {
             return false;
         }
 
@@ -176,8 +176,8 @@
         // File.separator.
         // When pattern starts with a File.separator, str has to start with a
         // File.separator.
-        if (str.startsWith(File.separator)
-                != pattern.startsWith(File.separator)) {
+        if (str.startsWith("/")
+                != pattern.startsWith("/")) {
             return false;
         }
 
@@ -495,7 +495,7 @@
      * @return a Vector of path elements from the tokenized path
      */
     public static Vector tokenizePath (String path) {
-        return tokenizePath(path, File.separator);
+        return tokenizePath(path, "/");
     }
 
     /**
@@ -616,14 +616,14 @@
      * @return the leftmost part of the pattern without wildcards
      */
     public static String rtrimWildcardTokens(String input) {
-        Vector v = tokenizePath(input, File.separator);
+        Vector v = tokenizePath(input, "/");
         StringBuffer sb = new StringBuffer();
         for (int counter = 0; counter < v.size(); counter++) {
             if (hasWildcards((String) v.elementAt(counter))) {
                 break;
             }
             if (counter > 0) {
-                sb.append(File.separator);
+                sb.append("/");
             }
             sb.append((String) v.elementAt(counter));
         }
Index: src/org/jruby/runtime/builtin/meta/FileMetaClass.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/builtin/meta/FileMetaClass.java,v
retrieving revision 1.13.2.3
diff -u -r1.13.2.3 FileMetaClass.java
--- src/org/jruby/runtime/builtin/meta/FileMetaClass.java	23 Jan 2006 05:23:41 -0000	1.13.2.3
+++ src/org/jruby/runtime/builtin/meta/FileMetaClass.java	24 Jan 2006 10:57:09 -0000
@@ -43,6 +43,7 @@
 import org.jruby.runtime.Arity;
 import org.jruby.runtime.builtin.IRubyObject;
 import org.jruby.util.IOModes;
+import org.jruby.util.SmartFile;
 
 public class FileMetaClass extends IOMetaClass {
     public FileMetaClass(IRuby runtime) {
@@ -277,7 +278,7 @@
 			}
 		}
 
-        if (new File(relativePath).isAbsolute()) {
+        if (new SmartFile(relativePath).isAbsolute()) {
             return getRuntime().newString(relativePath);
         }
 
@@ -291,7 +292,7 @@
             return getRuntime().getNil();
         }
 
-        File path = new File(cwd, relativePath);
+        SmartFile path = new SmartFile(cwd, relativePath);
 
         String extractedPath;
         try {
@@ -311,7 +312,7 @@
     public IRubyObject lstat(IRubyObject filename) {
     	RubyString name = RubyString.stringValue(filename);
 
-        return getRuntime().newRubyFileStat(new File(name.getValue()));
+        return getRuntime().newRubyFileStat(new SmartFile(name.getValue()));
     }
 
 	public IRubyObject open(IRubyObject[] args) {
@@ -349,12 +350,12 @@
     	RubyString newNameString = RubyString.stringValue(newName);
         oldNameString.checkSafeString();
         newNameString.checkSafeString();
-        File oldFile = new File(oldNameString.getValue());
+        SmartFile oldFile = new SmartFile(oldNameString.getValue());
         
         if (!oldFile.exists()) {
         	throw getRuntime().newErrnoENOENTError("No such file: " + oldNameString.getValue());
         }
-        oldFile.renameTo(new File(newNameString.getValue()));
+        oldFile.renameTo(new SmartFile(newNameString.getValue()));
         
         return RubyFixnum.zero(getRuntime());
     }
@@ -387,7 +388,7 @@
         for (int i = 0; i < args.length; i++) {
         	RubyString filename = RubyString.stringValue(args[i]);
             filename.checkSafeString();
-            File lToDelete = new File(filename.getValue());
+            SmartFile lToDelete = new SmartFile(filename.getValue());
             if (!lToDelete.exists()) {
 				throw getRuntime().newErrnoENOENTError(" No such file or directory - \"" + filename.getValue() + "\"");
 			}
Index: src/org/jruby/runtime/load/LoadService.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/runtime/load/LoadService.java,v
retrieving revision 1.6.2.5
diff -u -r1.6.2.5 LoadService.java
--- src/org/jruby/runtime/load/LoadService.java	22 Jan 2006 20:43:35 -0000	1.6.2.5
+++ src/org/jruby/runtime/load/LoadService.java	24 Jan 2006 10:57:09 -0000
@@ -31,7 +31,6 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby.runtime.load;
 
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -52,6 +51,7 @@
 import org.jruby.runtime.builtin.IRubyObject;
 import org.jruby.util.BuiltinScript;
 import org.jruby.util.PreparsedScript;
+import org.jruby.util.SmartFile;
 
 /**
  *
@@ -87,7 +87,7 @@
       
       String jrubyHome = System.getProperty("jruby.home");
       if (jrubyHome != null) {
-        char sep = File.separatorChar;
+        char sep = '/';
         String rubyDir = jrubyHome + sep + "lib" + sep + "ruby" + sep;
         
         addPath(rubyDir + "site_ruby" + sep + Constants.RUBY_MAJOR_VERSION);
@@ -210,7 +210,7 @@
             // Absolute path names
             if (name.startsWith("/") || name.startsWith("\\")) {
                	// Load from local filesystem
-                File current = new File(name);
+                SmartFile current = new SmartFile(name);
                 if (current.exists() && current.isFile()) {
                 	return new LoadServiceResource(current.toURL(), name);
                 }
@@ -239,9 +239,9 @@
                 } 
 
                	// Load from local filesystem
-                File current = new File(entry, name).getAbsoluteFile();
+                SmartFile current = (SmartFile)new SmartFile(entry, name).getAbsoluteFile();
                 if (current.exists() && current.isFile()) {
-                	return new LoadServiceResource(current.toURL(), new File(entry, name).getPath());
+                	return new LoadServiceResource(current.toURL(), new SmartFile(entry, name).getPath());
                 }
                 
                 // otherwise, try to load from classpath (Note: Jar resources always uses '/')
@@ -266,7 +266,7 @@
     /* Directories and unavailable resources are not able to open a stream. */
     private boolean isRequireable(URL loc) {
         if (loc != null) {
-        	if (loc.getProtocol().equals("file") && new File(loc.getFile()).isDirectory()) {
+        	if (loc.getProtocol().equals("file") && new SmartFile(loc.getFile()).isDirectory()) {
         		return false;
         	}
         	
Index: src/org/jruby/util/Glob.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/util/Glob.java,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 Glob.java
--- src/org/jruby/util/Glob.java	2 Jan 2006 07:07:12 -0000	1.8.2.1
+++ src/org/jruby/util/Glob.java	24 Jan 2006 10:57:09 -0000
@@ -68,7 +68,7 @@
     
     private static String canonicalize(String path) {
     	try {
-    		return new File(path).getCanonicalPath();
+    		return new SmartFile(path).getCanonicalPath();
     	} catch (IOException e) {
     		return path;
     	}
@@ -101,25 +101,25 @@
      * Get file objects for glob; made private to prevent it being used directly in the future
      */
     private void getFiles() {
-    	String pathSplitter = File.separator;
+    	String pathSplitter = "/";
     	
     	// Windows file delimeter needs to escape delimeter to prevent regex compilation error
     	if (File.separator.equals("\\")) {
-    		pathSplitter = pathSplitter + File.separator;
+    		//pathSplitter = pathSplitter + File.separator;
     	}
     	
 		for (Iterator iter = patterns.iterator(); iter.hasNext();) {
 			GlobPattern globPattern = (GlobPattern) iter.next();
 	        String[] dirs = globPattern.getPattern().split(pathSplitter);
-        	File root = new File(dirs[0]);
+        	SmartFile root = new SmartFile(dirs[0]);
         	int idx = 1;
         	if (glob2Regexp(dirs[0]) != null) {
-            	root = new File(".");
+            	root = new SmartFile(".");
             	idx = 0;
         	}
         	for (int size = dirs.length; idx < size; idx++) {
             	if (glob2Regexp(dirs[idx]) == null) {
-                	root = new File(root, dirs[idx]);
+                	root = new SmartFile(root, dirs[idx]);
             	} else {
 	                break;
     	        }
@@ -141,7 +141,7 @@
             	for (int i = 0, size = matchingFiles.size(); i < size; i++) {
                 	boolean isDirectory = idx + 1 != length;
                 	String pattern = dirs[idx];
-                	File parent = (File) matchingFiles.get(i);
+                	SmartFile parent = (SmartFile) matchingFiles.get(i);
                 	currentMatchingFiles.addAll(getMatchingFiles(parent, pattern, isDirectory));
             	}
             	matchingFiles = currentMatchingFiles;
@@ -150,7 +150,7 @@
 		}
     }
     
-    private static Collection getMatchingFiles(final File parent, final String pattern, final boolean isDirectory) {
+    private static Collection getMatchingFiles(final SmartFile parent, final String pattern, final boolean isDirectory) {
     	FileFilter filter = new FileFilter() {
             Pattern p = Pattern.compile(glob2Regexp(pattern));
 
@@ -159,7 +159,7 @@
             }
     	};
     	
-    	File[] matchArray = parent.listFiles(filter);
+    	SmartFile[] matchArray = (SmartFile[])parent.listFiles(filter);
         Collection matchingFiles = new ArrayList();
 
         if (matchArray != null) {
@@ -280,23 +280,23 @@
 	        // Make a boolean for this special case (how about multiple slashes?)
 	    	this.endsWithDelimeter = pattern.endsWith("/") || pattern.endsWith("\\");
 			
-	    	if (new File(pattern).isAbsolute()) {
+	    	if (new SmartFile(pattern).isAbsolute()) {
     			this.patternIsRelative = false;
     			this.pattern = canonicalize(pattern);
 	       	} else {
     	   		// pattern is relative, but we need to consider cwd; add cwd but remember it's relative so we chop it off later
        			this.patternIsRelative = true;
-       			this.pattern = canonicalize(new File(cwd, pattern).getAbsolutePath());
+       			this.pattern = canonicalize(new SmartFile(cwd, pattern).getAbsolutePath());
 	       	}
 		}
 
 		public ArrayList getMatchedFiles() {
 			ArrayList fileNames = new ArrayList();
 			int size = files.size();
-			int offset = cwd.endsWith(File.separator) ? 0 : 1;
+			int offset = cwd.endsWith("/") ? 0 : 1;
 			
 	        for (int i = 0; i < size; i++) {
-				String path = ((File) files.get(i)).getPath();
+				String path = ((SmartFile) files.get(i)).getPath();
 				String name;
 
 	        	if (patternIsRelative && path.startsWith(cwd)) {
Index: src/org/jruby/util/IOHandlerSeekable.java
===================================================================
RCS file: /cvsroot/jruby/jruby/src/org/jruby/util/IOHandlerSeekable.java,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 IOHandlerSeekable.java
--- src/org/jruby/util/IOHandlerSeekable.java	2 Jan 2006 07:07:12 -0000	1.8.2.1
+++ src/org/jruby/util/IOHandlerSeekable.java	24 Jan 2006 10:57:09 -0000
@@ -33,7 +33,6 @@
 
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
@@ -58,7 +57,7 @@
         
         this.path = path;
         this.modes = modes;
-        File theFile = new File(path).getAbsoluteFile();
+        SmartFile theFile = (SmartFile)new SmartFile(path).getAbsoluteFile();
 
         if (theFile.exists()) {
             if (modes.shouldTruncate()) {
Index: test/org/jruby/javasupport/test/RubyTestCase.java
===================================================================
RCS file: /cvsroot/jruby/jruby/test/org/jruby/javasupport/test/RubyTestCase.java,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 RubyTestCase.java
--- test/org/jruby/javasupport/test/RubyTestCase.java	2 Jan 2006 07:07:11 -0000	1.9.2.1
+++ test/org/jruby/javasupport/test/RubyTestCase.java	24 Jan 2006 10:57:09 -0000
@@ -31,7 +31,6 @@
  ***** END LICENSE BLOCK *****/
 package org.jruby.javasupport.test;
 
-import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -45,6 +44,7 @@
 import org.jruby.RubyString;
 import org.jruby.javasupport.JavaUtil;
 import org.jruby.runtime.builtin.IRubyObject;
+import org.jruby.util.SmartFile;
 
 public class RubyTestCase extends TestCase {
     private static final IRubyObject[] EMPTY_ARRAY = IRubyObject.NULL_ARRAY;
@@ -58,7 +58,7 @@
             throw new NullPointerException("url was null");
         }
         InputStream in = url.openStream();
-        File f = File.createTempFile("rtc", ".rb");
+        SmartFile f = (SmartFile)SmartFile.createTempFile("rtc", ".rb");
         FileOutputStream out = new FileOutputStream(f);
 
         int length;
Index: src/org/jruby/util/SmartFile.java
===================================================================
RCS file: src/org/jruby/util/SmartFile.java
diff -N src/org/jruby/util/SmartFile.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/org/jruby/util/SmartFile.java	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,131 @@
+package org.jruby.util;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.URI;
+
+public class SmartFile extends File {
+    private static final long serialVersionUID = 7630618150344842227L;
+
+    public SmartFile(String pathname) {
+        super(pathname);
+        // TODO Auto-generated constructor stub
+    }
+
+    public SmartFile(URI uri) {
+        super(uri);
+        // TODO Auto-generated constructor stub
+    }
+
+    public SmartFile(File parent, String child) {
+        super(parent, child);
+        // TODO Auto-generated constructor stub
+    }
+
+    public SmartFile(String parent, String child) {
+        super(parent, child);
+        // TODO Auto-generated constructor stub
+    }
+
+    public String getAbsolutePath() {
+        return super.getAbsolutePath().replace(File.separatorChar, '/');
+    }
+
+    public String getCanonicalPath() throws IOException {
+        // TODO Auto-generated method stub
+        return super.getCanonicalPath().replace(File.separatorChar, '/');
+    }
+
+    public String getPath() {
+        // TODO Auto-generated method stub
+        return super.getPath().replace(File.separatorChar, '/');
+    }
+
+    public String toString() {
+        // TODO Auto-generated method stub
+        return super.toString().replace(File.separatorChar, '/');
+    }
+
+    public File getAbsoluteFile() {
+        // TODO Auto-generated method stub
+        return new SmartFile(getAbsolutePath());
+    }
+
+    public File getCanonicalFile() throws IOException {
+        // TODO Auto-generated method stub
+        return new SmartFile(getCanonicalPath());
+    }
+
+    public String getParent() {
+        // TODO Auto-generated method stub
+        return super.getParent().replace(File.separatorChar, '/');
+    }
+
+    public File getParentFile() {
+        // TODO Auto-generated method stub
+        return new SmartFile(getParent());
+    }
+    
+    public static File[] listRoots() {
+        File[] roots = File.listRoots();
+        SmartFile[] smartRoots = new SmartFile[roots.length];
+        for (int i = 0; i < roots.length; i++) {
+            smartRoots[i] = new SmartFile(roots[i].getPath());
+        }
+        
+        return smartRoots;
+    }
+    
+    public static File createTempFile(String prefix, String suffix, File directory) throws IOException {
+        File file = File.createTempFile(prefix, suffix, directory);
+        return new SmartFile(file.getPath());
+    }
+    
+    public static File createTempFile(String prefix, String suffix) throws IOException {
+        File file = File.createTempFile(prefix, suffix);
+        return new SmartFile(file.getPath());
+    }
+
+    public String[] list() {
+        // TODO Auto-generated method stub
+        return super.list();
+    }
+
+    public String[] list(FilenameFilter filter) {
+        String[] files = super.list(filter);
+        String[] smartFiles = new String[files.length];
+        for (int i = 0; i < files.length; i++) {
+            smartFiles[i] = files[i].replace(File.separatorChar, '/');
+        }
+        return smartFiles;
+    }
+
+    public File[] listFiles() {
+        File[] files = super.listFiles();
+        SmartFile[] smartFiles = new SmartFile[files.length];
+        for (int i = 0; i < files.length; i++) {
+            smartFiles[i] = new SmartFile(files[i].getPath());
+        }
+        return smartFiles;
+    }
+
+    public File[] listFiles(FileFilter filter) {
+        File[] files = super.listFiles(filter);
+        SmartFile[] smartFiles = new SmartFile[files.length];
+        for (int i = 0; i < files.length; i++) {
+            smartFiles[i] = new SmartFile(files[i].getPath());
+        }
+        return smartFiles;
+    }
+
+    public File[] listFiles(FilenameFilter filter) {
+        File[] files = super.listFiles(filter);
+        SmartFile[] smartFiles = new SmartFile[files.length];
+        for (int i = 0; i < files.length; i++) {
+            smartFiles[i] = new SmartFile(files[i].getPath());
+        }
+        return smartFiles;
+    }
+}

