Selaa lähdekoodia

Filesystem fixes for backslash.

Mark Sibly 7 vuotta sitten
vanhempi
commit
8d834c75a9
1 muutettua tiedostoa jossa 15 lisäystä ja 0 poistoa
  1. 15 0
      modules/std/filesystem/filesystem.monkey2

+ 15 - 0
modules/std/filesystem/filesystem.monkey2

@@ -54,6 +54,8 @@ Global _config:=New StringMap<String>
 
 Function FixPath:String( path:String )
 	
+	path=path.Replace( "\","/" )
+	
 	Local root:=ExtractRootDir( path )
 	If Not root.EndsWith( "::" ) Return path
 	
@@ -328,6 +330,8 @@ A root directory is a directory path that:
 #end
 Function ExtractRootDir:String( path:String )
 	
+	path=path.Replace( "\","/" )
+	
 	If path.StartsWith( "//" ) Return "//"
 	
 	Local i:=path.Find( "/" )
@@ -355,6 +359,9 @@ End
 
 #end
 Function IsRootDir:Bool( path:String )
+	
+	path=path.Replace( "\","/" )
+	
 
 	If path="//" Return True
 	
@@ -466,6 +473,8 @@ This function will not strip slashes from a root directory path.
 #end
 Function StripSlashes:String( path:String )
 	
+	path=path.Replace( "\","/" )
+	
 	If Not path.EndsWith( "/" ) Return path
 	
 	Local root:=ExtractRootDir( path )
@@ -493,6 +502,8 @@ If `path` does not contain a directory component, an empty string is returned.
 
 #end
 Function ExtractDir:String( path:String )
+	
+	path=path.Replace( "\","/" )
 
 	path=StripSlashes( path )
 
@@ -541,6 +552,8 @@ End
 
 #end
 Function ExtractExt:String( path:String )
+	
+	path=path.Replace( "\","/" )
 
 	Local i:=path.FindLast( "." )
 	If i=-1 Return ""
@@ -559,6 +572,8 @@ End
 
 #end
 Function StripExt:String( path:String )
+	
+	path=path.Replace( "\","/" )
 
 	Local i:=path.FindLast( "." )
 	If i=-1 Return path