[fpc-pascal] Problems with moving/renaming file using sysutils.renamefile

Reinier Olislagers reinierolislagers at gmail.com
Fri Feb 10 12:19:09 CET 2012


Free Pascal Compiler version 2.6.0-1 [2012/01/13] for i386
Linux x86

Trying to move a file (and rename it at the same time):

//ExtractedCompiler is a string variable
//BootstrapCompiler is a string property
//I'm using my own version of debugln, not important here
debugln('Going to rename/move ' + ExtractedCompiler + ' to ' +
BootstrapCompiler);
sysutils.DeleteFile(BootstrapCompiler); //ignore errors
OperationSucceeded:=renamefile(ExtractedCompiler, BootstrapCompiler);

The program prints out this:
Debug: Going to rename/move /tmp/TMP00000.tmp.out to
/home/pascaldev/fpcbootstrap/i386-linux-ppc386-1
... but OperationSucceeded is set to false; file move failed.

Original file exists:
pascaldev at debianlazx86:~/fpcup$ ls /tmp/TMP00000.tmp.out
/tmp/TMP00000.tmp.out

Target directory exists:
ls /home/pascaldev/fpcbootstrap
#directory exists

And I can rename it using the shell:
pascaldev at debianlazx86:~/fpcup$ mv /tmp/TMP00000.tmp.out
/home/pascaldev/fpcbootstrap/i386-linux-ppc386-1
#yep, works:
pascaldev at debianlazx86:~/fpcup$ ls /home/pascaldev/fpcbootstrap
i386-linux-ppc386-1

What am I doing wrong here?

Thanks,
Reinier



More information about the fpc-pascal mailing list