@@ -3,19 +3,14 @@ import * as utilsModule from "utils/utils";
33
44// TODO: Implement all the APIs receiving callback using async blocks
55// TODO: Check whether we need try/catch blocks for the iOS implementation
6-
76export class FileSystemAccess {
8- private keyModificationTime = "NSFileModificationDate" ;
9- private userDomain = NSSearchPathDirectory . NSApplicationDirectory ; //1
10- private documentDir = NSSearchPathDirectory . NSDocumentDirectory ; //9
11- private cachesDir = NSSearchPathDirectory . NSCachesDirectory ; //13
127
138 public getLastModified ( path : string ) : Date {
149 var fileManager = NSFileManager . defaultManager ( ) ;
1510 var attributes = fileManager . attributesOfItemAtPathError ( path ) ;
1611
1712 if ( attributes ) {
18- return attributes . objectForKey ( this . keyModificationTime ) ;
13+ return attributes . objectForKey ( "NSFileModificationDate" ) ;
1914 } else {
2015 return new Date ( ) ;
2116 }
@@ -223,11 +218,11 @@ export class FileSystemAccess {
223218 }
224219
225220 public getDocumentsFolderPath ( ) : string {
226- return this . getKnownPath ( this . documentDir ) ;
221+ return this . getKnownPath ( NSSearchPathDirectory . NSDocumentDirectory ) ;
227222 }
228223
229224 public getTempFolderPath ( ) : string {
230- return this . getKnownPath ( this . cachesDir ) ;
225+ return this . getKnownPath ( NSSearchPathDirectory . NSCachesDirectory ) ;
231226 }
232227
233228 public getCurrentAppPath ( ) : string {
@@ -304,7 +299,7 @@ export class FileSystemAccess {
304299
305300 private getKnownPath ( folderType : number ) : string {
306301 var fileManager = NSFileManager . defaultManager ( ) ;
307- var paths = fileManager . URLsForDirectoryInDomains ( folderType , this . userDomain ) ;
302+ var paths = fileManager . URLsForDirectoryInDomains ( folderType , NSSearchPathDirectory . NSApplicationDirectory ) ;
308303
309304 var url = paths . objectAtIndex ( 0 ) ;
310305 return url . path ;
0 commit comments