It works perfectly. Thank you :)
MBS Plugins also have classes for alias files on Mac and newer CFBookmarkMBS module.
For Windows we also have a class for creating shortcut files. And we have methods for hard and soft links.
Well, Christian, I love your products, but finding anything on your site is even worse than the proverbial needle in the haystack. That is where I looked first, before giving up, after wasting about half an hour chasing the uncooperative wild goose.
Thank you for the links, though.
Hello Christian. Using cfbookmarkmbs class to create an Alias is the same things to have a shell command like:
ln -s /users/user/documents/Imyfolder /users/user/Desktop/myfolder.alias ?
I got troubles, because Alias created by the class are not recognized from Dropbox. Alias created by cfbookmarkmbs are seen like simple files but ones created by the cmmand 'ln' are seen like folders and are put in synch with Dropbox....
I'm stuck on this I m asking help to understand how to solve this issue. Thanks.
I am not sure this is the same. The command you show is a symbolic link, which can easily break if it is move, or if the target moves.
I believe MBS creates real OS X aliases, which follow the target if it is moved.
Now, the issue with DropBox may also come from the fact that intrinsically, DropBox is NOT OS X. Like most cloud systems, it is probably Linux. And Linux does snot know about osx aliases. Likewise, it does not deal very well with Windows shortcuts.
Then create symbolic link with a shell and be done with it.
You don't seem to quite understand that Symbolic Link is a Unix/Linux thing, whereas an Alias is a feature of macOS which does much more, as it is attached to the target in a way that makes it able to follow it if it is moved, or even renamed. I would tend to believe the state of the art is the most powerful, which is macOS alias.
But, most importantly, what do you want to do with Dropbox and symbolic links ? How are you stuck ?
Please be aware that we offer a lot of functions depending on platform or what you need (alias, soft link, hard link)
(see CFBookmarkMBS.WriteBookmarkDataToFile to write alias file)
NSFileManagerMBS with createSymbolicLink and linkItem functions:
See also WindowsJunctionMBS for creating symbolic link for Windows:
@Carlo DSimone The point is. Sandbox App doesn't permit to use shell command execution.
Uh ? This topic has been explored several times in the forum. For my part, I have half a dozen apps currently in the MAS that use plain out of the box shell in sandbox to call Unix commands. A couple of them are actually simple UI wrappers for command line.
However, you need to launch the shell with the Cocoa API if you want to use helpers, for instance. Sam Rowlands has posted the declare somewhere, but for myself, I simply use the MBS plugin LaunchServicesFindApplicationForInfoMBS .
The best solution for me is try to use NSFIlemanagerMBS. Hope App Wrapper doesn't cut off the code....It is for sure that this code:
mShell = New Shell c = "ln -s '" + Replaceall(ff.shellpath,"\","") + "' " + DropBoxFolder.shellpath + "/'" + s +"'" mShell.Execute(c)
createSymbolicLink(path as string, destPath as string, byref error as NSErrorMBS) as boolean
doesn't work as expected because I have an error....
Instead if I use (note the parameters switch):
createSymbolicLink(destPath as string,path as string, byref error as NSErrorMBS) as boolean
Now I have only to test if App Wrapper likes the code....
Sorry Christian, About symlink and NSFilemanagerMBS Class, I read from docs:
This method does not traverse symbolic links. If the item at the path is a symbolic link—that is, the value of the NSFileType key in the attributes dictionary is NSFileTypeSymbolicLink—you can use the destinationOfSymbolicLinkAtPath method to retrieve the path of the item pointed to by the link. You can also use the stringByResolvingSymlinksInPath method of NSString to resolve links in the path before retrieving the item's attributes.
destinationOfSymbolicLinkAtPath is method of which class ? How to implement It ?
THanks again for your precious help.