Archive: "Error Opening File for Writing"


"Error Opening File for Writing"
I am trying to create an installer that will install several fixes for problems that come up at our help desk. Basically, the client chooses one option, and it will install that patch. Right now I'm stuck on this one piece of the puzzle:

Section /o "TimJr PCP Fix" g1o8

SetOutPath %DESKTOP

Call RunPCPFix
MessageBox MB_OK|MB_ICONEXCLAMATION "Please make sure that TIM SR (CIS and \
ETMMAIN) are closed before proceeding. A Talk-2-Jr will \
be run as part of the fix, so please ensure that \
your Jornada is connected."

File "TimJrPCP.exe"
File "pcp.bat"
ExecWait "%DESKTOP\pcp.bat"
Delete "%DESKTOP\TimJrPCP.exe"
Delete "%DESKTOP\pcp.bat"

SectionEnd


The simple exercise is that it extracts this executable file and a batch file, runs the batch file and then deletes both files off the desktop. This code compiles fine, but when I'm trying to run the installer, I'll get a "error opening file for writing" error. I'm not sure what's going on, but this is happening for both the executable and the batch file. I checked the forum, and the only things I got there that were useful were to check if the files are read only (they're not) and to check the outpath to make sure that the directories were created (given that it's the desktop constant, it should be.

Can anyone help?

Actually, while I'm at it, I'll ask two related questions, because I think I can do most of what the batch file does right in my script, if I could get it to unpack the files properly.

One of the things I need to do is copy the executable to two sepeate places and rename it. Could I just do that easily with by adding an oname switch to the file command? If so, I know i could just use ExecWait for the command I need to run (or if not, just have it extract a batchfile with the commands to run into $TEMP and ExecWait on that).

I'm mostly confused, however, because other sections of my script extract and install files to various directories, and I have tested these sections and they work without a problem, so I'm a bit baffled about what's happening here, unless it's due to compression (I'm using lzma, but I also tried zlib and had the same issue).

I would really appreciate any help that anyone could provide for me.


Uhm, the first thing I noticed there is that you've used %DESKTOP and not $DESKTOP. It's $ not %!

Use NSIS' CopyFiles to copy files!

-Stu


Wow, this was a silly error. That was it.

Thanks for your help :)