Skip to content

Instantly share code, notes, and snippets.

@krhoyt
Created November 7, 2013 18:36
Show Gist options
  • Save krhoyt/7359612 to your computer and use it in GitHub Desktop.
Save krhoyt/7359612 to your computer and use it in GitHub Desktop.
Locate a file on the desktop using system paths (as opposed to specific path).
- ( NSString * ) locateFileOnDesktop : ( NSString * ) fileName
{
NSArray * directories;
NSFileManager * manager;
NSMutableString * path;
manager = [NSFileManager defaultManager];
directories = NSSearchPathForDirectoriesInDomains( NSDesktopDirectory, NSUserDomainMask, YES );
path = [[NSMutableString alloc] initWithString : [directories objectAtIndex : 0]];
[path appendString: @"/"];
[path appendString: fileName];
NSLog( @"%@", path );
return path;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment