Re: Can't rename a folder
- From: clinisbut <clinisbut@xxxxxxxxx>
- Date: Fri, 28 Mar 2008 02:40:42 -0700 (PDT)
On Mar 28, 9:56 am, clinisbut <clinis...@xxxxxxxxx> wrote:
I'm trying to rename a folder with
RenameFile( old_name, new_name );
But it's throwing an error 32 (file/folder already in use).
I checked both paths and are correct.
I suspect the error comes from a TOpenDialog.
This TOpenDialog asks the user to open a file:
openDialog:= TOpenDialog.Create( nil );
openDialog.InitialDir := Dir + 'projects';
openDialog.Filter := 'XML files|*.xml|All files|*.*';
openDialog.Title := 'Select a file project';
openDialog.Options := [ofReadOnly];
//Display openDialog
if openDialog.Execute then
load_project_info( openDialog.FileName )
openDialog.free;
This works ok, but after that I'm not able to modify any file/folder
element inside folder selected by user.
load_project_info loads some data from file selected, but this is not
the problem 'cause I try to comment this line and the error persists.
I'm not able to change folder's name not even from windows explorer
(after using TOpenDialog); when my program exits then I can.
Nevermind, I solve the problem adding the option: ofNoChangeDir
ofNoChangeDir: After the user clicks OK, resets the current directory
to whatever it was before the file-selection dialog opened.
openDialog:= TOpenDialog.Create( nil );
openDialog.InitialDir := Dir + 'projects';
openDialog.Filter := 'XML files|*.xml|All files|*.*';
openDialog.Title := 'Select a file project';
openDialog.Options := [ofReadOnly,ofNoChangeDir];
//Display openDialog
if openDialog.Execute then
load_project_info( openDialog.FileName )
else
ShowMessage( 'Open file was cancelled' );
openDialog.free;
.
- Follow-Ups:
- Re: Can't rename a folder
- From: Maarten Wiltink
- Re: Can't rename a folder
- References:
- Can't rename a folder
- From: clinisbut
- Can't rename a folder
- Prev by Date: Can't rename a folder
- Next by Date: Re: Can't rename a folder
- Previous by thread: Can't rename a folder
- Next by thread: Re: Can't rename a folder
- Index(es):