• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: symlinks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: symlinks


  • Subject: Re: symlinks
  • From: Emmanuel LEVY <email@hidden>
  • Date: Fri, 13 Aug 2010 00:16:28 +0200

Luther,

I've setup an example : I have an AFP-shared disk Library in / Volumes/. There is a folder _maj on it. I've made a symlink to / Volumes/Library/_maj on my Desktop.

I've named the symlink "fred".

--
set f to "Macintosh HD:Users:emmanuel:Desktop:fred:"
--

This works for me :

--
set a to f as alias
--> alias "Library:_maj:"
--

Note at this point that a is a very relevant object, but its transcription into text is removing some vital information. How shall I know if this is in /Network or in /Volumes?

Also, this works :

--
read file f
--> "../../../Volumes/Library/_maj/"
--

What may sometimes not work is this:

--
set a to (f as alias)
set actualfolder to (a as text)
set somepath to actualfolder & "some:path:to:some:item"
(for instance:) read alias somepath
--

because actualfolder will always say "Library" whereas it may sometimes be "Library-1", "Library-2" or actually whatever name provided by whatever mounted the disk.

Maybe this is what happened, otherwise I don't see what's wrong with your script.

The solution for this particular problem is to never use hfs textual paths, only posix paths (or urls if you like percent signs). Which gives:

--
set f to "/Users/emmanuel/Desktop/fred/"
set actualfolder to posix path of (f as alias) -- may be /Volumes/ Library-1/etc
set somepath to actualfolder & "some/path/to/some/item"
read posix file somepath
--


Emmanuel


On Aug 12, 2010, at 5:53 PM, Luther Fuller wrote:

How does the system and applications use symlinks to relocate items that usually appear in the user's home folder?

For example:
Safari stores files, such as bookmarks, in the folder ~/Library/ Safari/
This folder can be moved to another location, perhaps an external disk, and replaced by a symlink file which points to the new location. (At least I have encountered information indication that this can be done. I haven't experimented, yet.)


For the past couple of weeks, I have looked for documentation on this and have found nothing.
If my script discovers that ~/Library/Safari/ exists, but is a symlink instead of a folder, how does AppleScript identify the "original item" of the symlink. Are there any rules for naming the symlink file?


I know of one user of my software who has replaced ~/Library/Mail/ with a symlink.
My script ...


((path to library folder from user domain) as text) & "Mail:Mailboxes:"
tell application "Finder"
try
set mailPath to the result as alias
on error
error "Unable to find your ~/Library/Mail/Mailboxes/ folder. Have you installed Mail?"
end try


errors when it encounters the symlink.

Does anyone know of any documentation on the use of symlinks this way?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript- email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: symlinks
      • From: Luther Fuller <email@hidden>
References: 
 >symlinks (From: Luther Fuller <email@hidden>)

  • Prev by Date: symlinks
  • Next by Date: Re: symlinks
  • Previous by thread: symlinks
  • Next by thread: Re: symlinks
  • Index(es):
    • Date
    • Thread