The simplest solution is
But in the case of running the application in sudo mode it gives us the root's desktop path. To fix it use
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES ); NSString* theDesktopPath = [paths objectAtIndex:0];
But in the case of running the application in sudo mode it gives us the root's desktop path. To fix it use
NSString* home = [[[NSProcessInfo processInfo] environment] objectForKey:@"HOME"]; NSString *pathToDesktop = [NSString stringWithFormat:@"%@/Desktop", home];
Комментариев нет :
Отправить комментарий