Archive: !tempfile - most bizarre problem


!tempfile - most bizarre problem
On my dev machine I have C and D drives (D is working drive), so HM NIS Editor and makensis executables are installed on that drive. When I create the installer.exe, and copy it to a test machine (only C drive), the strangest thing happen.

When, in the beginning of my script, I call four macros (!tempfile) to create temporary filenames, they all point to "D:\temp...." !!!!! Surely it must now be "C:\temp..."?

How is this possible? Even more, how do I fix it?

makensis ver 2.18, hm nis edit 2.0.3

Please advise!


!tempfile simply uses the directory Windows reports as the temporary directory. If you've set it to D:\temp, that's what it'd be.

If you want to create temporary file names on runtime, you should use GetTempFileName.


Originally posted by kichik
!tempfile simply uses the directory Windows reports as the temporary directory. If you've set it to D:\temp, that's what it'd be.


That's what is so bizarre. The test machine has no D drive - why is it trying to create a tempfile on that drive?

If you want to create temporary file names on runtime, you should use GetTempFileName.
Thanks will try

Because that piece of code is not running on the test machine, it's running on the developer machine. Preprocessor instructions are executed at compile time, not runtime. What you're looking for is GetTempFileName.