Guest User

Untitled

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