cocoa - Display Contents of Symbolic Link using NSURL -
example path:
/users/mike/desktop/media
i create symbolic link "media" folder , name "my media."
that checks out. want show contents of my media folder confirm successful creation of symbolic link.
a "targetfield" textbox displays correct path string symbolic link lastpathcomponent:
/users/mike/desktop/my media
prior mavericks following code show contents of symbolic link folder in finder window:
nsstring *path = [targetfield stringvalue]; nsurl *fileurl = [nsurl fileurlwithpath:path]; nsarray *fileurls = [nsarray arraywithobjects:fileurl, nil]; [[nsworkspace sharedworkspace] activatefileviewerselectingurls:fileurls];
in mavericks code opens original target folder, not symbolic link folder. realize technically contents of both folders same. point code no longer reflects symbolic link last component in new path. reverts target folder (media) , opens instead.
does description make sense? there way make work did prior mavericks?
thanks.
your description doesn't make complete sense me. "technically contents of both folders same" not make sense, if have symbolic link folder have one folder, not 2 same contents. i'm not sure you're asking, here guess:
running code under mountain lion opens finder window showing desktop , highlighting "my media". open same window, without highlighting can use openurl:
or openfile:
on parent folder of path. e.g. using urls:
nsurl *fileurl = [nsurl fileurlwithpath:path.stringbydeletinglastpathcomponent]; [nsworkspace.sharedworkspace openurl:fileurl];
or strings:
[nsworkspace.sharedworkspace openfile:path.stringbydeletinglastpathcomponent];
addendum
after clarification think after is:
[nsworkspace.sharedworkspace selectfile:path infileviewerrootedatpath:path.stringbydeletinglastpathcomponent];
the method selectfile:infileviewerrootedatpath:
defined not follow symbolic links. under mavericks highlights link itself.
hth
Comments
Post a Comment