Archive: rename fails in oninit.nsh


rename fails in oninit.nsh
I have a user who is running into a rename failure on his PC and his alone. For some odd reason, it has something to do with where the Nullsoft install exe is created. When an install exe is created on his own PC, both renames works fabously every time. When the same install exe is created on the build server or any where else, the 2nd rename fails on his PC. The renames are in the oninit.nsh header and are used to determine if any files in the product install folder are in use (locked). The first rename works fine, but the rename back to the original does not work. Has anyone seen this before? What could cause this?

; check for locked destination folder rename "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}" "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}tmp"
IfFileExists '$STR_JAVAINSTALLPATH\${PRODUCT_NAME}tmp' renameworked renamefailed
...
renameworked:
rename "$STR_JAVAINSTALLPATH\${PRODUCT_NAME tmp" "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}"


Originally posted by kalverson
rename "$STR_JAVAINSTALLPATH\${PRODUCT_NAME tmp" "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}"
It might work better if you fix the typo.

rename "$STR_JAVAINSTALLPATH\${PRODUCT_NAME} tmp" "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}"

And note MSG's typo (the space after the }). If you are wondering why things don't work then throw in some MessageBox's that display the actual instruction and its arguments. It is basic debugging skills.

Stu


Originally posted by Afrow UK
And note MSG's typo (the space after the }).
Actually the original had one as well, so I just left it in. Since it's a folder name it can have spaces. :)

Since it's working on other PC's, I suppose it's a typo in this post, not in the original code.

Maybe the first rename is not finished when the second rename is called, so the tmp folder is still locked by the first rename action.
I think I read a post before somewhere on the forum that the rename call does return before the rename is really finished.


Originally posted by MSG
Actually the original had one as well, so I just left it in. Since it's a folder name it can have spaces. :)
Correct but his correct string (in the comment) does not have a space.

Another option is to build with logging on. We now use the logging build by default and logs are uploaded to a central server if an install fails.

See: http://nsis.sf.net/Special_Builds

Stu

Originally posted by Afrow UK
Correct but his correct string (in the comment) does not have a space.
I stand corrected. :-)

Originally posted by MSG
It might work better if you fix the typo.

rename "$STR_JAVAINSTALLPATH\${PRODUCT_NAME} tmp" "$STR_JAVAINSTALLPATH\${PRODUCT_NAME}"
Yes, I noticed the typo as well, but that occurred during the my posting. The closing } was in the original code which is working well. I wrote a small c program to do the rename for me and that worked well on the failing PC.

If you think this is a bug then please submit a bug report. Also to test further you could put in a small Sleep and see if that fixes it.

Stu