realbasic-nug
[Top] [All Lists]

Re: Error 105 on FolderItem.MoveFileTo (again)

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Error 105 on FolderItem.MoveFileTo (again)
From: Tom Benson <tombenson at mac dot com>
Date: Tue, 27 Feb 2007 18:36:52 +1100
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <692BE603-55DD-473D-AE97-FBB029848350 at mac dot com> <603F7C13-109F-4775-9C12-5C91C230186E at mac dot com> <EE6172EE-25D8-44AB-A0C3-352E0D5B1A5E at mac dot com>
OK.

If you're comfortable with UNIX, why not just do this???

dim s as new shell
s.execute "mv "+source.shellpath+" "+dest.shellpath

- Tom

On 27/02/2007, at 6:30 PM, Guyren Howe wrote:

> 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>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>