• 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: Path to library folder w/ network home directory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Path to library folder w/ network home directory?


  • Subject: Re: Path to library folder w/ network home directory?
  • From: Shandor Simon <email@hidden>
  • Date: Mon, 21 May 2007 17:04:01 -0500


Chris Nebel, helped me work through this issue (thanks Chris!), but I thought I would share with the list the answer, in case anyone else ever comes across this problem. It turns out, when I used "path to library folder from user doman as string" the "as string part" somehow changed the value of my path to something that was incorrect. Simply omitting "as string" caused the "path to library folder from user domain" to return the correct path.


As for why I was doing this, the full code was actually:

tell application "Finder"

set profilefolders to folder ((path to library folder from user domain as string) & "Application Support:Firefox:Profiles")
...
end tell


I needed the "as string" bit so I could concatenate the string to include those other folders. Instead I changed my code to:

tell application "Finder"

set profilefolders to folder "Profiles" of folder "Firefox" of folder "Application Support" of folder (path to library folder from user domain)
...
end tell


Thanks again Chris!


Shandor


On Mon, 21 May 2007 09:45:15 -0700
Christopher Nebel <email@hidden> wrote:

On May 21, 2007, at 9:28 AM, Shandor Simon wrote:

In one of my scripts, I'm trying to get the path to a folder in a users Library folder. I use the following to do so:

tell application "Finder"
set profilefolders to folder (path to library folder from user domain as string)
end tell


This works fine on my computers, but fails to find the correct path on users who have a network mounted home directory. Is there anything that I can do in that situation?

That script looks essentially correct, though there are two (mostly) pedantic errors:
- "as string" should be "as Unicode text", or it will choke on paths that have sufficiently interesting characters. In fact, you don't need the "as" bit at all; Finder is perfectly happy to work with the alias that "path to" returns by default.
- As a matter of style, it's widely considered best to put the "path to" expression outside the "tell" block, though it shouldn't make a difference in this case.
Aside from that, it looks like it ought to work, and does with my network home. (Don't read too much into that, though; there are lots of different kinds of network home directories.) What's the error, exactly?
--Chris Nebel
AppleScript Engineering
_______________________________________________
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: Path to library folder w/ network home directory?
      • From: Sander Tekelenburg <email@hidden>
    • Re: Path to library folder w/ network home directory?
      • From: Michelle Steiner <email@hidden>
  • Prev by Date: with timeout / try & on error
  • Next by Date: Re: with timeout / try & on error
  • Previous by thread: Re: Path to library folder w/ network home directory?
  • Next by thread: Re: Path to library folder w/ network home directory?
  • Index(es):
    • Date
    • Thread