Archive: Convert GetTempFilename to directory


Convert GetTempFilename to directory
I've seen that NSIS looks like it takes a temp filename and converts it to a directory somehow for use as the PLUGINS directory. I would like to do something similar because I have a utility exe that must be extracted to a temp location and has dependant DLLs. The DLL dependencies just need to be extracted to the same location as the exe, but they must be the same name. So to ensure I don't run into conflicts, I wanted to generate a unique directory name and then place all the files in it. Since GetTempFileName already creates the file, I'm not sure the best way to convert it to a dir. Delete the file and then create the directory of the same name?

Instead of this:

Var /GLOBAL _SomeUtilityEXE
GetTempFileName $_SomeUtilityEXE
File /oname=$_SomeUtilityEXE "..\bin\SomeUtility\SomeUtility.exe"
ExeWait "$_SomeUtilityEXE"

I want something like this:

Var /GLOBAL _SomeUtilityDir
GetTempFileName $_SomeUtilityDir
;Somehow convert $_SomeUtilityDir from a file to directory
SetOutPath $_SomeUtilityDir
File "..\bin\SomeUtility\SomeUtility.exe"
File "..\bin\SomeUtility\SomeNeededDll.dll"
ExeWait "$_SomeUtilityDir\SomeUtility.exe"

Thanks


There's no special trick to do this... Your guess to delete the file and then create a directory with the same name is exactly what NSIS is doing.


Thanks