Thursday, 15 July 2010

nsurl - NSFileManager - fileExistsAtPath:? -



nsurl - NSFileManager - fileExistsAtPath:? -

i trying understand how utilize nsfilemanager, have file exist on desktop , nsfilemanager method fileexistsatath: returning false when come in path of file. seems missing something. here code.

nsfilemanager *filemanager = [nsfilemanager defaultmanager]; //self.pathtoread /users/nikita/desktop/asdf.wav nsstring *readpath = [[nsurl fileurlwithpath:[self.pathtoread stringvalue]] absolutestring]; //readpath file:///users/nikita/desktop/asdf.wav if(![filemanager fileexistsatpath:readpath]) nslog(@"file not exist!");

change:

nsstring *readpath = [[nsurl fileurlwithpath:[self.pathtoread stringvalue]] absolutestring];

to

nsstring *readpath = [[nsurl fileurlwithpath:[self.pathtoread stringvalue]] path];

nsurl nsfilemanager

No comments:

Post a Comment