Delphi and Kylix

Moderators: pritaeas
Number of threads: 7244
Number of posts: 19051

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Some questions about file copying Posted by jobromedia on 23 Dec 2005 at 5:05 PM
I'm using the API function to copy a file, but the problem is that it doesn't copy the file at all.

The goal is to create a folder (sourcecode completed), then copy a file supplied in the same directory as the exe resides in to the same parent dir that the folder was created in and rename the file to the folder adding an .info extension.

Yes I've tried as hard as I can to do this, but nothing seams to happen.

So any help would be highly aprechiated.

Here is the form paint procedure that copies the directory if the curdir string is empty:

if curdir = '' then curdir := form2.DirectoryListBox1.Directory;


This is the copy code I'm using:

Copyfile(pchar(Curdir+'Empty.info'),pchar(form2.directorylistbox1.directory+drawer.text));


Should copy the file, but either it generates a file not found or copies the files somewhere I don't have a clue about.
Report
Re: Some questions about file copying Posted by zibadian on 23 Dec 2005 at 7:16 PM
: I'm using the API function to copy a file, but the problem is that it doesn't copy the file at all.
:
: The goal is to create a folder (sourcecode completed), then copy a file supplied in the same directory as the exe resides in to the same parent dir that the folder was created in and rename the file to the folder adding an .info extension.
:
: Yes I've tried as hard as I can to do this, but nothing seams to happen.
:
: So any help would be highly aprechiated.
:
: Here is the form paint procedure that copies the directory if the curdir string is empty:
:
:
: if curdir = '' then curdir := form2.DirectoryListBox1.Directory;
: 

:
: This is the copy code I'm using:
:
:
: Copyfile(pchar(Curdir+'Empty.info'),pchar(form2.directorylistbox1.directory+drawer.text));
: 

:
: Should copy the file, but either it generates a file not found or copies the files somewhere I don't have a clue about.
:
Sounds like the values for the CurDir and form2.directorylistbox1.directory are not what you expect them to be. Check wether or not they contain trailing backslashes, that they don't contain "weird" characters, which are illegal in file paths, etc.
Report
Re: Some questions about file copying Posted by jobromedia on 24 Dec 2005 at 3:31 AM
: : I'm using the API function to copy a file, but the problem is that it doesn't copy the file at all.
: :
: : The goal is to create a folder (sourcecode completed), then copy a file supplied in the same directory as the exe resides in to the same parent dir that the folder was created in and rename the file to the folder adding an .info extension.
: :
: : Yes I've tried as hard as I can to do this, but nothing seams to happen.
: :
: : So any help would be highly aprechiated.
: :
: : Here is the form paint procedure that copies the directory if the curdir string is empty:
: :
: :
: : if curdir = '' then curdir := form2.DirectoryListBox1.Directory;
: : 

: :
: : This is the copy code I'm using:
: :
: :
: : Copyfile(pchar(Curdir+'Empty.info'),pchar(form2.directorylistbox1.directory+drawer.text));
: : 

: :
: : Should copy the file, but either it generates a file not found or copies the files somewhere I don't have a clue about.
: :
: Sounds like the values for the CurDir and form2.directorylistbox1.directory are not what you expect them to be. Check wether or not they contain trailing backslashes, that they don't contain "weird" characters, which are illegal in file paths, etc.
:
I skipped the curdir parameter and added an extra directorylistbox to copy the directory from. Copy process completed.

Thanks for your help!



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.