문제

In my ~/Library/Caches/ directory, I have a symbolic link to my app's bundle, and some symbolic links to images (e.g. "big_picture.png" is a symlink to "small_picture.png"). When I try to check if the symlinks exist, using the NSFileManager's fileExistsAtPath: method, it returns NO, even when the symlink does exist, and it links to a file that exists as well.

As far as I know, Apple's documentation claims that what I'm trying to do should work. Am I doing something wrong, or is this a bug?

도움이 되었습니까?

해결책

fileExistsAtPath might follow the symlink. Maybe you can try a different method -- Use attributesOfItemAtPath:error:. A dictionary will be returned if the file exists, and it will give you the ability to check the file type. To do the latter, call fileType on the dictionary and check it against NSFileTypeSymbolicLink.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top