This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

Copy Fails of Files
Started by
murali_s
, May 15 2006 12:02
8 replies to this topic
Posted 15 May 2006 - 12:02
Hi,
I have the following code to copy a zip file from the current directory.
I have the following code to copy a zip file from the current directory.
CODE |
nvResult = CopyFile(".\\test.zip", path + "\\" + TestFolder + "\\test.zip"); if(nvResult < 0) then MessageBox("Copy Failed ", INFORMATION); svErrorMessage = FormatMessage( nvResult ); SprintfBox( WARNING, "CreateDir Error", "CreateDir failed!\n\nError code: %ld\nMessage text: %s", nvResult, svErrorMessage ); else MessageBox("Copy SuccessFul ", INFORMATION); |
I have build the script and the name of the executable file is Test.exe. When I build there are two exe's created namely the usual setup.exe and Test.exe . when I run the setup.exe the copy works fine, but when I run the Test.exe the copy fails.
Could anyone give me some hint on why this happens.
With Regards
Murali
Posted 15 May 2006 - 16:27
Not sure what this test.exe is but if it's a (self-extracting) single file setup then it's essentially running from the TEMP folder.
Stefan Krüger
InstallSite.org twitter facebook
Posted 16 May 2006 - 04:26
Hi Stefan,
You had asked me what this Test.exe is basically the project that I have created is an InstallScript Project. In the Product Properties, there is an option to specify the [I]Executable File[I], and there I have specified it as Test.exe. Now when I build (i.e. Build Release 1) for this project the following listed folders are generated
In the Package folder Test.exe is created, this is the file that I am refering to, and additionally in the folder Disk Images there is a folder called Disk 1 which has a setup.exe. So its the Test.exe from the Package Folder that I run to do the copy. and it doesnt work. Could provide me with the hint on why this doesnt work.
With Regards
Murali
You had asked me what this Test.exe is basically the project that I have created is an InstallScript Project. In the Product Properties, there is an option to specify the [I]Executable File[I], and there I have specified it as Test.exe. Now when I build (i.e. Build Release 1) for this project the following listed folders are generated
- Disk Images
- Log Files
- Package
- Report Files
In the Package folder Test.exe is created, this is the file that I am refering to, and additionally in the folder Disk Images there is a folder called Disk 1 which has a setup.exe. So its the Test.exe from the Package Folder that I run to do the copy. and it doesnt work. Could provide me with the hint on why this doesnt work.
With Regards
Murali
Posted 16 May 2006 - 11:29
I guess it's because test.exe extracts the setup file to the tmep folder an runs setup from there. You can test this by adding a message box that displays SRCDIR
Stefan Krüger
InstallSite.org twitter facebook
Posted 16 May 2006 - 11:40
Hi Stefan,
You are correct, the execution happens in a temp folder. But I am also creating a batch file in the CURRENT DIRECTORY from where this Test.exe will be executed, that is being created correctly, only the copying fails. Could you say me how I can over come this problem
With Regards
Murali
You are correct, the execution happens in a temp folder. But I am also creating a batch file in the CURRENT DIRECTORY from where this Test.exe will be executed, that is being created correctly, only the copying fails. Could you say me how I can over come this problem
With Regards
Murali
Posted 16 May 2006 - 11:49
If test.zip is next to your test.exe then you should use PACKAGE_LOCATION as source location for the copy command.
Stefan Krüger
InstallSite.org twitter facebook
Posted 19 May 2006 - 06:28
Hi Stefan,
But PACKAGE_LOCATION gives the fully qualified file name in my example if the Test.exe is being executed from a folder called "C:\Test", then PACKAGE_LOCATION gives you "C:\Test\Test.exe".
So should I truncate the last part and use this as the location or is there a better way to do this.
Its actually strange that this doesnt work, because currently I am using "." to create a batch file in the folder.
With Regards
Murali
But PACKAGE_LOCATION gives the fully qualified file name in my example if the Test.exe is being executed from a folder called "C:\Test", then PACKAGE_LOCATION gives you "C:\Test\Test.exe".
So should I truncate the last part and use this as the location or is there a better way to do this.
Its actually strange that this doesnt work, because currently I am using "." to create a batch file in the folder.
With Regards
Murali
Posted 19 May 2006 - 15:45
QUOTE |
So should I truncate the last part and use this as the location |
Yes.
Test.exe extracts setup.exe to the temp folder. Then your setup runs from there, so .\ is the temp folder.
Stefan Krüger
InstallSite.org twitter facebook
Posted 22 May 2006 - 04:45
Hi Stefan,
I have fixed this using by doing the following.
ParsePath(pathOfSetup, PACKAGE_LOCATION, PATH);
nvResult = CopyFile(pathOfSetup + "\\test.zip", targetlocation+ "\\" + "test" + "\\test.zip");
With Regards
Murali
I have fixed this using by doing the following.
ParsePath(pathOfSetup, PACKAGE_LOCATION, PATH);
nvResult = CopyFile(pathOfSetup + "\\test.zip", targetlocation+ "\\" + "test" + "\\test.zip");
With Regards
Murali