Skip to content
⌘ NSIS Forum Archive

Get temp folder

9 posts

metalogic#

Get temp folder

Hi all,
I need to create a temp folder. Either that or just use the temp folder that NSIS uses (I'm assuming it uses one anyway).

That's because I'm downloading a file and I need to extract it. Then I want to remove the whole folder when I'm done.

I found a function for getting a temp file name but not one for a temp folder.

Any help appreciated.

TIA,
Santiago
metalogic#
Kichik,
Thanks you for your reply.

$TEMP returns the windows temp folder. What I really need is a folder inside of $TEMP which I can delete when I'm done. So this won't work.

$PLUGINSDIR would work I guess, as long as I call InitPluginsDir first (since I need the folder before I call the download plugin). I'll try this.

Thanks again,
Santiago
metalogic#
That's how I initially coded it. But thinking about it further, I couldn’t guarantee that “myfolder” wouldn’t already exist. So I decided that a temp folder would be a safer way to go.
metalogic#
Joost,
I agree with you. The plug-ins folder works great for my scenario. So you can consider this thread solved.

Something worth mentioning is that if I wasn't using plug-ins, this solution wouldn't have been feasible. So even though I'm good to go, a GetTempFolder statement could be a good feature to have for the future.

Thanks,
Santiago
Joost Verburg#
Why? Using InitPluginsDir, you can always create the plug-in directory, even if you are not using plug-ins.
metalogic#
Ah!
I didn't realize that. In that case we're all good to go.

Case closed.

Thanks,
Santiago