Page 1 of 1
Environment variables look like to be missing for external t
Posted: Thu Mar 30, 2017 4:26 pm
by patrickz22
Hello,
I would like to create a tool which would use SB preference file to get JDK and SB path after app creation, per-project basis.
But it seems no environment variables are set, when I list all environment variable (using PB) I only have standard variables set, not any from SB IDE.
Is it the right behaviour in this situation?
Thanks.
Re: Environment variables look like to be missing for extern
Posted: Fri Mar 31, 2017 2:30 am
by tj1010
AppData\Roaming\SpiderBasic\SpiderBasic.prefs
has JDK path and registry has SB path in uninstall and extension keys.
You can add a compiler and proxy to SB. This isn't a bug.
Re: Environment variables look like to be missing for extern
Posted: Fri Mar 31, 2017 2:38 pm
by patrickz22
tj1010 wrote:AppData\Roaming\SpiderBasic\SpiderBasic.prefs
has JDK path and registry has SB path in uninstall and extension keys.
Basically agree with that.
But environment variables allow to be sure of the used path.
You can add a compiler and proxy to SB. This isn't a bug.
So why, in the documentation, section The SpiderBasic IDE->External Tools, we can read this...
The IDE provides additional information for the tools in the form of environment variables.
When there are no any environment variable set?
I wanted to use PB_TOOL_Preferences to get the preferences file instead of hard-coding a path.
Because if I run the IDE with the /P command line (also documented) the preferences file won't be at the same place.
Re: Environment variables look like to be missing for extern
Posted: Fri Mar 31, 2017 4:40 pm
by Peter
with this PB-Code:
Code: Select all
Global.s PB_TOOL_IDE = GetEnvironmentVariable("PB_TOOL_IDE")
Global.s PB_TOOL_Compiler = GetEnvironmentVariable("PB_TOOL_Compiler")
Global.s PB_TOOL_Preferences = GetEnvironmentVariable("PB_TOOL_Preferences")
OpenConsole()
PrintN("PB_TOOL_IDE: '" + PB_TOOL_IDE + "'")
PrintN("PB_TOOL_Compiler: '" + PB_TOOL_Compiler + "'")
PrintN("PB_TOOL_Preferences: '" + PB_TOOL_Preferences + "'")
Input()
CloseConsole()
i get this output:
PB_TOOL_IDE: 'C:\SpiderBasic\SpiderBasic.exe'
PB_TOOL_Compiler: 'C:\SpiderBasic\Compilers\sbcompiler.exe'
PB_TOOL_Preferences: 'C:\Users\peter\AppData\Roaming\SpiderBasic\SpiderBasic.prefs'
so i guess, it's not a bug.
Greetings ... Peter
Re: Environment variables look like to be missing for extern
Posted: Sat Apr 01, 2017 9:53 am
by tj1010
According to the docs they are PID based and passed by RunProgram(). Probably set by static PB library.
The naming doesn't surprise me because a lot of constants still use "PB" too.
Re: Environment variables look like to be missing for extern
Posted: Sat Apr 01, 2017 11:55 am
by T4r4ntul4
The naming doesn't surprise me because a lot of constants still use "PB" too.
Thats for compatibility with PB. I dont think that will ever change. (you can use code from PB to SB)
Re: Environment variables look like to be missing for extern
Posted: Sun Apr 02, 2017 12:35 pm
by patrickz22
Hi,
When have you executed your code? after creating an APK?
Per-project basis?
That's the case I executed mine, examined all environment variables and had nothing at all except Windows environment variables.
There might be something different with your test and with mine.
Re: Environment variables look like to be missing for extern
Posted: Sun Apr 02, 2017 1:16 pm
by patrickz22
Here is my code:
Code: Select all
If ExamineEnvironmentVariables()
EnvList$ = "Variables:"
While NextEnvironmentVariable()
EnvList$+ #CRLF$ + EnvironmentVariableName() + " = " + EnvironmentVariableValue()
Wend
MessageRequester("env", EnvList$)
A simple point which came to me, because of file system permissions under Win7, it seems I have to run my tool as an administrator. In fact I want to enhance this:
http://forums.spiderbasic.com/viewtopic ... 3&start=10 (page 2). I would prefer to obtain informations from environment variables instead of being confident only in a installed version of the IDE without any command line parameters passed.
Maybe it is the reason why I haven't the environment variable in the list?
It look like strange if administrator privileged apps could access less informations, but nothing is impossible with Microsoft...
EDIT: confirmed, nothing is impossible with Microsoft...
Sorry for this wrong bug.