I'm writing a little piece of code in which I should detect if an NSURL contains a symbolic link (i.e., symbolic file components other than the last one should also be detected). To do this, I confront the NSURL itself with the NSURL returned by -URLByResolvingSymlinksInPath. The problem is that this method seems to return all symbolic links in lowercase. Is there another way to solve this problem?
Resolving all symbolic links in NSURL
2.3k Views Asked by Nickkk At
2
There are 2 best solutions below
1
Tricertops
On
You can traverse symlinks manually:
Detect symbolic link using
-[NSFileManager attributesOfItemAtPath:error:]and in keyNSFileTypesearch forNSFileTypeSymbolicLinkvalue.Get destination path using
-[NSFileManager destinationOfSymbolicLinkAtPath:error:]and append them.
Repeat this for every path component.
Related Questions in COCOA
- How do I customize NSOutlineView to have border color?
- How to generate request format for WCF web service method for Mac and iPhone
- How to Handle Command Line Prompt from a Cocoa App
- Change views inside NSSplitViewController
- CMYK NSImage get pixel data
- Reactive Cocoa Conditional Split ?
- Set background color of NSImageView with proportionally sized image
- Use NSWindow or NSViewController?
- Imports and includes in header files - when is it okay?
- How to prevent the app from automatically open a window when launched?
- Swift NSViewController responds to mouseDown event, but not keyDown event
- "stringByAddingPercentEncodingWithAllowedCharacters" replaces more characters than it should
- cocoa - what happen when close a window (by pressing the red X button)?
- Does it necessary to go back to main thread to update UI?
- WebView not responding to Keyboard input
Related Questions in PATH
- formatting path string in javascript
- Simplexml get path from variable
- Azure Web App PATH Variable Modification
- In Android, would it be possible to open a file in the 'values' folder and to read its content?
- Using paths bonded to a XCode project to be shared
- How would I be able to use a file in visual studio project on any computer?
- How to add directories to Cygwin gcc default search path
- Joomla css path incorrect
- R CMD recognize only some commands
- Generate TCPDF output to a shared drive folder
- How to get the exe path in nsis script?
- Issues with relative/absolute path
- relative path to .Exe
- Path of the current, parents and root directory
- JOptionPane Message with File Path
Related Questions in NSURL
- How do I give inputs through NSURL
- URL Variable is not being recognized using NSURL
- unable to display urls in table @ masterViewController
- How do I load an HTTP URL with App Transport Security enabled in iOS 9?
- NSURL URLWithString is shortening very long strings with an ellipsis "...", creating invalid NSURL objects
- Swift 2.0 not downloading images to UI ImageView
- NSData dataWithContentsOfURL returning nil specifically in iOS 8
- Swift - UILabel from URL
- UIImage returns null first time, until reloaded?
- NSURL/NSURLRequest is unexpectedly nil
- NSURLRequest swift getting fatal error exception
- Parsing JSON into a usable format
- How To Get External URL thumbnail iOS
- writeToFile: returning correct path, but no file?
- AVAudioPlayer didn't run from url file in Swift Programming
Related Questions in SYMLINK
- Alternative to symlink in C++ Builder
- How to use a main bib file with the Isabelle document preparation system?
- Difference between symlink and alias
- Emulate symlinks and use them in PHPstorm
- Mounting a symlinked folder in vagrant & virtualbox
- Symlink Exclude in Bash Script
- Symlink from Dropbox to External Directory Share
- Wordpress theme not recognized
- How to move up a level from an symbolic link in OSX
- "Cannot set fs attributes on a non-existent symlink target" error on symlink Ansible creation
- Python failing to create symlinks
- Many Docker Containers and Thrift
- Git: can I get git to store contents of a link create with ln?
- How do I get a symlinked /etc/hostname to take effect at boot
- R Won't Install Packages (ldpaths)
Related Questions in SYMLINK-TRAVERSAL
- How to move up a level from an symbolic link in OSX
- In nodejs, cwd option of `child_process.exec` is not honored if script is executed from the symlinked directory of cwd
- Bash Script Not allowing special symbols in zipping a file
- OSX Apache web pages on external drive don't work
- Are there any problems with this symlink traversal code for Windows?
- Resolving symlinks in lua
- Traverse subdirectores and symlink certain files (but not all)
- How to get diff to NOT follow symlinks?
- Cygwin: follow symlinks with MinGW fopen/etc
- Docker follow symlink outside context
- How can I tell if a symbolic link exists at a certain path?
- Python os.walk + follow symlinks
- Resolving all symbolic links in NSURL
- in git bash in windows ln -s /destinations/path/ link_name just copies the destination rather than creates a link
- How to make Mercurial detect changes made to the target of a symlink
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Either I really did something wrong or this bug was fixed with the latest Mountain Lion update. Now all symlinks are correctly resolved.