Writing out a file bug?
Writing out a file bug?
- Subject: Writing out a file bug?
- From: Nigel Smith <email@hidden>
- Date: Thu, 14 Aug 2003 11:09:28 +0100
Or is this a known issue that I just haven't noticed before?
I know that if you explicitly overwrite a file with a shorter version, you
have to reset the file's eof to 0 to avoid data from the first version being
present in the second.
I *thought* that, if you let the user choose where to save the file and they
choose to overwrite an existing file, pressing "Replace" in the ensuing
dialog, that the OS would take care of this.
This script will demonstrate -- run it once giving two different file specs,
and once giving the same file spec and accepting the dialog's "Replace"
option:
--------
set newFile to choose file name with prompt "Save file as..."
set newFileRef to open for access newFile with write permission
write "aaaaa" to newFileRef
close access newFileRef
display dialog (read newFile)
set newFile to choose file name with prompt "Save file as..."
set newFileRef to open for access newFile with write permission
write "bbb" to newFileRef
close access newFileRef
display dialog (read newFile)
--------
Does this mean that we should always set the destination eof to 0, just in
case they choose to save over an older version?
Or am I doing something stupid :-)
Later,
Nigel
_______________________________________________
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.