Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *resourcesPath = [[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Contents"] stringByAppendingPathComponent:@"Resources"]; //Path to the app's Resources folder.
- NSString *defaultsPlistPath = [resourcesPath stringByAppendingString:@"/Defaults.plist"]; //Path to the plist inside the app that lists the default xpref files.
- NSArray *defaultsArray = [[NSDictionary dictionaryWithContentsOfFile:defaultsPlistPath] objectForKey:@"xScript"]; //Array of all files listed in Defaults.plist
- for (NSString *scriptFile in defaultsArray) { //Repeat through the array of default files.
- NSLog(@"<DEBUG>Loading %@", scriptFile);
- NSString *filePath = [[resourcesPath stringByAppendingString:@"/"] stringByAppendingString:scriptFile]; //Path to the file we are going to copy.
- NSLog(@"<DEBUG>Path to xScript file: %@", filePath);
- NSString *endPath = [[[supportPath stringByAppendingPathComponent:@"Scripts"] stringByAppendingString:@"/"] stringByAppendingString:scriptFile];
- NSLog(@"Attempting to move %@ to %@", filePath, endPath);
- [fm movePath:filePath toPath:endPath handler:nil]; //Move the default into the support folder.
- }
Add Comment
Please, Sign In to add comment