Created
November 7, 2013 18:36
-
-
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).
This file contains 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
- ( 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