On Feb 27, 2007, at 1:18 AM, Tom Benson wrote:
> Yeah.... You are correct, moving a file into a file would not make
> sense.....
>
> moving existing files into the Temp Items folder can be tricky
> business....
>
> Can I ask why you're not creating them there in the first place using
> GetTemporaryFolderItem???
>
> Otherwise (if you are not using the system provided temporary items
> folder), consider doing it this way:
>
> Store a reference to your temp folder in a property
>
> if not tempFolder.child(tempFile.name).exists then
> tempfile.moveFileTo(tempFolder)
> else
> //error, already exists...
> end
Seems to me that moving a file to a (non-existent) folderitem
representing a file makes perfect sense. Move the file so it's called
this at this location. Heck, on Unix OSes, you rename files by moving
them to a different name.
I'm doing some work where I need to roll back changes if something
goes wrong. So I'm doing two phases: when I, say, delete a file, I
first move it to /tmp. Anyway.
The issue would appear to be with .MoveFileTo, not with its being to
do with the temporary items folder.
> On 27/02/2007, at 5:40 PM, Guyren Howe wrote:
>
>> I am attempting to move a file into the temp folder.
>>
>> I get a folderItem for a file inside the temp folder. This folderItem
>> doesn't exist.
>>
>> I do foo.MoveFileTo theTempFileThatDoesntExist
>>
>> This gives me a foo.LastErrorCode = 105 ("Invalid name") and the file
>> doesn't move.
>>
>> I *hypothesize* that I can only move a file to a folder, not to a
>> file. I can sometimes get moving to a file to work, but I sometimes
>> get the 105 (can't find a pattern).
>>
>> So then I try to do:
>>
>> foo.MoveFileTo TheTempFileThatDoesntExist.Parent
>> too.Name = TheTempFileThatDoesntExist.Name
>>
>> And this works on the Mac but fails on Windows. Sometimes...
>>
>> I've wound up doing a #If TargetMacOS that does the the two-step
>> move-
>> rename on the Mac and the single-step move on Windows, and that
>> appears to work.
>>
>> Is this all just sadly inconsistent between platforms, or am I
>> missing something, or what?
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>