• 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: File Access Issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File Access Issues


  • Subject: Re: File Access Issues
  • From: "John W. Baxter" <email@hidden>
  • Date: Fri, 19 Sep 2003 16:34:40 -0700
  • Envelope-to: email@hidden

On 9/18/2003 23:31, "Emmanuel" <email@hidden> wrote:

>
> At 4:47 PM -0700 18/09/03, Randy Beaudreault wrote:
>> Hi Everyone,
>>
>> I'm having problems getting the following code to run properly:
>> set Date_File to open for access
>> ":Users:maccult:Library:Preferences:once-a-day"
>> close access Date_File
>>
>> Every time I run it, after a first run that creates the file in the first
>> place, I get this message:
>> Duplicate file name. :Users:maccult:Library:Preferences:once-a-day
>>
>> Is this an AppleScript bug or a bug in my script?
>
> I don't know whether this is relevant to your problem, but your script is the
> 1st time I see an AppleScript path starting with ":Users". Are you sure that's
> legal?

Well, it's legal. Context suggests that this is intended to be the usual
Users folder, not somewhere else. So it's unlikely to be useful (or
intended).

The path starting with :Users is a relative path through the Users directory
found in the current working directory.

So only if the current working directory were / would the path starting with
:Users be useful.

The usual way to phrase it as a Macintosh path would be to name the startup
volume and make the path absolute:

nicedisk:Users:maccult:Library:Preferences:once-a-day

Or of course, use a Unix path: /Users/.../once-a-day
In the proper context for that.

For folks coming to the Mac from Unix:
:X in Mac is very different from /X in Unix
The first leading : in a Mac path says "this is relative". Another subtle
point is that :: somewhere in a path is "up one from here", rather than the
second : being a noop, as the second (first?) of consecutive /s is in a Unix
path. So abc::def is def within the current working directory (if abc is a
directory), rather than being def in abc, as abc//def is.

Some of this goes back to the Macintosh origins, in which there were (400K
floppy) disks and files on the disks, denoted as disk:file. Finder in those
days created the illusion of a hierarchy, but the actual structure was flat.
So all the Unix complexity from those days wasn't needed (and a different
delimiter was wisely chosen, since it had a different job).

--John
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: File Access Issues (From: Emmanuel <email@hidden>)

  • Prev by Date: Re: Finding and deleting specific extensions
  • Next by Date: Re: choose application list - revisited
  • Previous by thread: Re: File Access Issues
  • Next by thread: choose application list - revisited
  • Index(es):
    • Date
    • Thread