On Dec 14, 2009, at 7:54 AM, Aparajita Fishman wrote:

>> If I do another move call    move document($bugpath;$tpath), it will rename 
>> the file, it just won't do a move and rename in one call.
>> 
>> Should I file a bug report, or did I miss something in the documentation?
> 
> Could be a bug, but it won't get fixed, I can't afford to spend time fixing 
> anything but critical bugs in v4.5.

and

On Dec 14, 2009, at 8:38 AM, Oliver Brodwolf wrote:

> It could be, that the Pathname is to long.
> I had problems like this too.
> First you could try shorter folder names......

I do remember a problem with pathnames being over 80 characters - plugin API 
problem. These were not over 80 (close 76!). I  wrapped the path names in 
a4d.utils.chopText and it still failed to move and rename. Since this is a 
Active4D enhanced 4D command, I'm not sure that the chopped text would be 
passed to 4D.

So...

Maybe someone else will confirm this. Just in case it is a bug and you need 
move and rename, stick this method somewhere.

<code>
        method "moveDocument"($fpath;$tpath)
                $fdir := directory of($fpath) 
                $tdir := directory of($tpath)
                $ffile := filename of($fpath)
                $tfile := filename of($tpath)
                if ($ffile = $tfile) //Plain move
                        move document($fpath;$tpath)
                        if (ok = 0)
                                return(false)
                        end if
                else //move and rename
                        move document($fpath;$tdir+$ffile)
                        if (ok = 0)
                                return(false)
                        end if
                        move document($tdir+$ffile;$tdir+$tfile)
                        if (ok = 0)
                                move document($tdir+$ffile;$fpath) //?? put 
file back??
                                return(false)
                        end if
                end if
                return(true)
        end method
        
        //test
        $fpath := "/Macintosh 
HD/Users/salex/work/AIDTdb/webrest/app/views/Citizens/show.a4d"
        $tpath := "/Macintosh 
HD/Users/salex/work/AIDTdb/webrest/rgen/xdelete/9BD1BB11show.a4d"
        if(moveDocument($fpath;$tpath))
                writebr("It moved and renamed file")
        else
                writebr("Something wrong, stupid ok set to 0")
        end if
</code>

Never did like the stupid ok variable that you must test separately.

Steve

_______________________________________________
Active4D-dev mailing list
Active4D-dev@aparajitaworld.com
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to