First, I am using 5.5.2 on OS X 10.3.4 in case it matters.
On May 31, 2004, at 6:49 AM, Thomas Reed wrote:
I noticed that the docs say a temporary file can't be renamed.
I think that must be an error in the docs or a misreading of them. I
can't find it, though, where does it say this?
In the online LR under the description of the name property. "It will
rename files if the user has permission to rename them, they are not in
use, and it's not a folder or temporary file."
Obviously that seems wrong, at least about folders. At least I'm pretty
sure I've renamed folders using the name property.
What I am doing is storing received data in a temporary file created
with GetTemporaryFolderItem. After the data is received, I move the
file to a non-temporary location and then I want to give it a proper
name.
This is a perfectly acceptable use of temporary files. I do it
myself. Perhaps you can post some sample code that isn't working for
you.
tempFile = GetTemporaryFolderItem
tempStream = tempFile.CreateBinaryFile("binary")
//write the data ...
tempFile.close
//In another method f gets the value of tempfile from a dictionary
where the reference was stored earlier
//tFile is the folder I want to move the data file to and then I rename
it with the filename from the original transfer request
f.MoveFileTo tFile //This works fine
tFile.Name = aRequest.filenames(i) //THIS FAILS TO RENAME ends up
with name like Temp-1234
I've found that I can make it work if I start with a new folderitem and
get the Temp-1234 file by using child with the name
f.MoveFileTo tFile //Again works fine
f2 = tFile.child(f.name) //get new folderitem reference to temp file
f2.Name = aRequest.filenames(i) //This now works???
Strange ain't it?
Kevin
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|