Created
March 15, 2015 02:57
-
-
Save benbahrenburg/86d4870e2f7ec036937e to your computer and use it in GitHub Desktop.
TIMOB-17458
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Download Ti SDK https://github.com/benbahrenburg/titanium_mobile/tree/TIMOB-17458 | |
or you can just patch by doing the following: | |
A) In your SDK open TiApp.m | |
B) add the following method | |
- (void)createDefaultDirectories | |
{ | |
NSError* error = nil; | |
NSURL* dir = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory | |
inDomain:NSUserDomainMask | |
appropriateForURL:nil | |
create:YES | |
error:&error]; | |
if(error) | |
{ | |
DebugLog(@"[ERROR] %@ %@", error, [error userInfo]); | |
} | |
} | |
C) In the TiApp.m find the method - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions_ | |
D) At the end of the methd right before the return add [self createDefaultDirectories]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To test the method use the following | |
var dir = Ti.Filesystem.getApplicationSupportDirectory(); | |
console.log(dir); | |
var f = Titanium.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory); | |
console.log('Directory Exists: '+ (f.exists() ? 'Yes' : 'No')); | |
var testfile = Ti.Filesystem.getFile(Ti.Filesystem.applicationSupportDirectory, 'text.txt'); | |
if(testfile.exists()){ | |
testfile.deleteFile(); | |
} | |
testfile.write("text written via write()\n"); | |
console.log("Check file at:" + testfile.nativePath); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment