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 answers
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
- In what context can we use an unqualified #selector() expression in Swift?
- How can I trigger macOS system gamepad API based on a value received from iOS app through core bluetooth
- Using sort descriptors in Outline View
- NSTableView to NSOutlineView Drag & Drop not accepting drop
- How to remove horizontal line in bottom of section NSTableView?
- CGSRegionRef: How is an arbitrary region represented as union of rects?
- Listen for Touch Events on MacOS (Trackpad)
- Window "yanks" when moving
- Writing NSFilePromiseProviders to pasteboard blocks app on quit
- Basic ImGui program doesn't render, leaks memory and crashes
- NSTokenField suggestion using context menu in swift
- How to link multiple text views to a single text storage in TextKit 2
- I would like to know why I’m not getting IBOutlets connected in an App’s window
- How to make a custom event loop in Cocoa?
- Why is restoreWindow(withIdentifier:state:) called after applicationDidFinishLaunching(_:)?
Related Questions in PATH
- How to write a clickable link in VS Code terminal that points to a multiline range?
- Can't run Python's mapscript because of a missing DLL
- How change path to my new generated webp image in index.html?
- Correct way to compare file paths when one is canonical and other absolute
- make Error 2, The system cannot find the file specified
- Tkinter treeview displaying and selecting rows question
- Running clang64.exe or mingw64.exe incorrectly sets PATH
- Python project deployment on Ubuntu 18 server
- FileNotFoundError while trying to load dataset from drive
- Powershell Receive-File issue
- BlendMode does not work as expected with a path and circle in Jetpack Compose
- return all paths in a nested dictionary that also contains a list in python
- How to show and change Image inside a Flask Route?
- What is vue router :matchRest(.*)* and when should I use it?
- Cassandra Installation Issue on Windows 11- 64bit
Related Questions in NSURL
- Do we have a list of NSURL Error Code Values given by Apple somewhere?
- Is it safe to assume that the initializer URLComponents(url:resolvingAgainstBaseURL:) never returns nil?
- iOS 17 NSURL percentage gets double encoded
- Defining the type of a completionHandler in Objective-C
- Why does NSURL POST file upload task fail to upload to web server
- UnwantedCommunicationReportingExtension API calling failing
- how to convert NSUrl into local path url in swift
- openURL fails with Settings Scheme
- Path part of "filename.m4v" is "/private/tmp", which is unexpected
- How to convert ImageSourse to NSUrl or CGImage in xamarin ios
- How to convert string with spaces to NSURL
- stringByRemovingPercentEncoding resulting in null string
- Assuring that HTTP cannot be used with NSImage initWithContentsOfUrl (and other such APIs)
- How to remove paramters in NSURL's query in iOS?
- How do I query for Finder NSURL?
Related Questions in SYMLINK
- Keep multi-version of a static-lib like what we do for shared-libs
- Too many levels of symbolic links nvim
- Listing all files in the directories and subdirectories recursively in c++
- Symlink Import Error in React "Module parse failed: Unexpected token"
- rsync omit times for symlinks
- How to create a symlink using ansible.builtin.file with wildcard in src path?
- error while deploying my a react js project
- iTerm2 keeps recreating symlink
- How to gracefully reload gunicorn changing symlink under supervisor
- Symbolic link not present in final image file system when using multilib feature in Yocto
- set location of .snakemake directory
- Why Github could be not showing my symliked README's images?
- git: check-in a file in a symlink directory fails
- Rsync -l flag is not working as expected for simlink
- why is is_regular_file reporting true for symbolic link
Related Questions in SYMLINK-TRAVERSAL
- In nodejs, cwd option of `child_process.exec` is not honored if script is executed from the symlinked directory of cwd
- Symlinks not working from Explorer but work fine from cmd shell
- How to create a symbolic link or hard link to another symbolic link?
- Traversing multiple symbolic links recursively in Python
- OSX Apache web pages on external drive don't work
- Bash Script Not allowing special symbols in zipping a file
- Cygwin: follow symlinks with MinGW fopen/etc
- Resolving symlinks in lua
- How to create symlinks in laravel for a directory to a external link
- How do I checkout then copy to all files at the destination of a symlink at once?
- perl symlink immediate target
- Which methods of java.nio.file.Files follow symbolic links and which don't?
- Create symlinks for directories that don't exist - Windows
- Is there a way to determine the destination path of a symlink in node?
- in git bash in windows ln -s /destinations/path/ link_name just copies the destination rather than creates a link
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?
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)
Either I really did something wrong or this bug was fixed with the latest Mountain Lion update. Now all symlinks are correctly resolved.