Selaa lähdekoodia

Added InternalDir() to filesystem and internal:: stream protocol.

Mark Sibly 8 vuotta sitten
vanhempi
commit
9c64b540ae

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

@@ -8,6 +8,8 @@ Using libc
 
 
 #If __TARGET__="android"
 #If __TARGET__="android"
 #Import "native/Monkey2FileSystem.java"
 #Import "native/Monkey2FileSystem.java"
+#Elseif __TARGET__="ios"
+#Import "native/filesystem.mm"
 #endif
 #endif
 
 
 Extern
 Extern
@@ -46,6 +48,14 @@ Returns true if successful.
 #end
 #end
 Function CopyFile:Bool( srcPath:String,dstPath:String )="bbFileSystem::copyFile"
 Function CopyFile:Bool( srcPath:String,dstPath:String )="bbFileSystem::copyFile"
 
 
+#If __TARGET__="ios"
+
+Extern Private
+
+Function getInternalDir:String()="bbFileSystem::getInternalDir"
+	
+#EndIf
+
 Private
 Private
 
 
 Function FixPath:String( path:String )
 Function FixPath:String( path:String )
@@ -202,7 +212,15 @@ Function InternalDir:String()
 	Local dir:=env.CallStaticStringMethod( cls,mth,Null )
 	Local dir:=env.CallStaticStringMethod( cls,mth,Null )
 	
 	
 	Return dir
 	Return dir
+	
+#Elseif __TARGET__="ios"
+
+	local dir:=getInternalDir()
+	
+	Return dir
+	
 #Endif
 #Endif
+
 	Return ""
 	Return ""
 End
 End
 
 

+ 2 - 2
modules/std/filesystem/native/Monkey2FileSystem.java

@@ -6,7 +6,7 @@ public class Monkey2FileSystem{
 
 
     private static final String TAG = "Monkey2FileSystem";
     private static final String TAG = "Monkey2FileSystem";
     
     
-    static public String getIntenalDir(){
+    public static String getInternalDir(){
     
     
 		//Log.v( TAG,"getInternalDir()" );
 		//Log.v( TAG,"getInternalDir()" );
     
     
@@ -17,7 +17,7 @@ public class Monkey2FileSystem{
 	    return "";
 	    return "";
     }
     }
     
     
-    static public String getExternalDir(){
+    public static String getExternalDir(){
     
     
 		//Log.v( TAG,"getExternalDir()" );
 		//Log.v( TAG,"getExternalDir()" );
     
     

+ 7 - 0
modules/std/filesystem/native/filesystem.h

@@ -13,6 +13,13 @@ namespace bbFileSystem{
 	bbArray<bbString> appArgs();
 	bbArray<bbString> appArgs();
 	
 	
 	bbBool copyFile( bbString srcPath,bbString dstPath );
 	bbBool copyFile( bbString srcPath,bbString dstPath );
+	
+#if BB_IOS
+	
+	bbString getInternalDir();
+	
+#endif
+
 }
 }
 
 
 #endif
 #endif

+ 11 - 0
modules/std/filesystem/native/filesystem.mm

@@ -0,0 +1,11 @@
+
+#include "filesystem.h"
+
+#include <UIKit/UIKit.h>
+
+bbString bbFileSystem::getInteralDir(){
+
+	NSString *docs=[@"~/Documents" stringByExpandingTildeInPath];
+
+	return bbString( docs )+"/";
+}