Page 1 of 1
Manually set the Temp folder
Posted: Tue Nov 18, 2014 4:21 pm
by Tenaja
I wish we could set a Temporary folder.
Currently, as far as I can tell, the only control we have over the Temp folder is no control, or in the Source Directory.
I wish we could put it in a specific folder. My IT guy switched me to a new antivirus, but it is a nightmare to configure. It would be a whole lot easier if I could set it to appdata\Local\PB_Tests, or something like that. The way it is now, using a shared Temp folder, makes it nearly impossible to configure.
Thanks.
Re: Manually set the Temp folder
Posted: Tue Nov 18, 2014 4:53 pm
by Little John
You can try to start PB from a batch file, where previously the temp directory is set to a location of your choice, e.g. on Windows (not tested):
Code: Select all
SET temp=C:\Users\Tenaja\AppData\Local\PB_Tests
C:\Program Files\PureBasic\PureBasic.exe %1
//edit 2015-09-16:
Here is more comprehensive code and explanation.
Re: Manually set the Temp folder
Posted: Tue Nov 18, 2014 5:31 pm
by Tenaja
Is that permanent, or only for PB?
Re: Manually set the Temp folder
Posted: Tue Nov 18, 2014 5:39 pm
by Little John
Tenaja wrote:Is that permanent, or only for PB?
That is only for the programs which are launched from that batch file (after the "SET temp=..." line).
Re: Manually set the Temp folder
Posted: Mon Nov 24, 2014 6:19 pm
by Tenaja
I must be doing something wrong, because this will not launch the IDE, but just compile one file. That means it will not work with the debugger. Or, and I just stuck with it that way?
Re: Manually set the Temp folder
Posted: Mon Nov 24, 2014 6:59 pm
by Little John
Works here on Windows 7 "as advertised".

The file "PureBasic.exe" is the IDE.
Re: Manually set the Temp folder
Posted: Tue Nov 25, 2014 1:06 am
by Tenaja
I get a dos box flash up and disappear too quickly to read. Maybe it does not work for me because I have a space in the directory. (starts with C:\Program Files (x86).) Is there an easy workaround?
Re: Manually set the Temp folder
Posted: Tue Nov 25, 2014 1:20 am
by Mistrel
Put double quotes around the path.
Re: Manually set the Temp folder
Posted: Thu Nov 27, 2014 5:05 pm
by Tenaja
Little John wrote:You can try to start PB from a batch file, where previously the temp directory is set to a location of your choice, e.g. on Windows (not tested):
Code: Select all
SET temp=C:\Users\Tenaja\AppData\Local\PB_Tests
C:\Program Files\PureBasic\PureBasic.exe %1
Little John, I appreciate your suggestion, but everything I have tried, and I cannot prevent PB from using the Windows TEMP folder. I tried it with and without quotes around the directories, and I tried it with both of those lines on the same line, as well as on separate lines (the way they pasted). Even with the "Create temporary executable in the source directory" option set, PB still creates a *.TMP file within the \Temp folder.
The reason I need this is because my IT guy took us to a new AV, and it is not PB-friendly. (Other than PB, I prefer it over the old one; it found some malware that the old one did not find...) Unfortunately, every file the AV stops is in the AppData\Local\Temp folder, and the file extension is always *.TMP, so PB does not get to make an exe. Obviously every *.TMP file within the \Temp folder is far too generic to exclude, so I figured I would try to create a pb-specific temp folder, but that is eluding me.
I tried running PB with the \Portable switch, and even then, the AV stopped it, flagging a *.TMP file within the \Temp folder...so obviously the \Portable switch does not do what one would hope.
This was easy when I could just whitelist PureBasic_Compilation0.exe through PureBasic_Compilation9.exe, but as long as I have the debugger enabled, PB does not get past the linker.
Thanks.
Re: Manually set the Temp folder
Posted: Thu Nov 27, 2014 5:34 pm
by IdeasVacuum
I think this is an urgent matter, I hope Fred can make this tiny improvement soon.
Re: Manually set the Temp folder
Posted: Thu Nov 27, 2014 5:47 pm
by Little John
Tenaja wrote:Little John, I appreciate your suggestion, but everything I have tried, and I cannot prevent PB from using the Windows TEMP folder.
I'm sorry that the suggestion does not work for you. As I wrote, it works as expected on my system.
Tenaja wrote:Even with the "Create temporary executable in the source directory" option set, PB still creates a *.TMP file within the \Temp folder.
Then something strange seems to go on
on your system. Sorry again, I've got no idea what the reason could be.
I cannot recall ever having seen PB automatically create a file with extension .TMP.
Re: Manually set the Temp folder
Posted: Thu Nov 27, 2014 6:17 pm
by IdeasVacuum
I get a dos box flash up and disappear too quickly to read.
you can add a
line so that you can see.
Code: Select all
SET temp=C:\Users\Tenaja\AppData\Local\PB_Tests
C:\Program Files\PureBasic\PureBasic.exe %1
pause
..... but I'm not sure if that Batch File is setting Temp for PB or re-locating Temp for the whole system?
Re: Manually set the Temp folder
Posted: Thu Nov 27, 2014 6:22 pm
by Little John
IdeasVacuum wrote:..... but I'm not sure if that Batch File is setting Temp for PB or re-locating Temp for the whole system?
http://www.purebasic.fr/english/viewtop ... 03#p456203
Re: Manually set the Temp folder
Posted: Fri Nov 28, 2014 4:29 pm
by Tenaja
Little John wrote:I cannot recall ever having seen PB automatically create a file with extension .TMP.
It is caught by the AV program, and the PB error message box indicates a linker error.