Environment variables look like to be missing for external t

Just starting out? Need help? Post your questions and find answers here.
patrickz22
Posts: 6
Joined: Thu Mar 23, 2017 6:42 pm

Environment variables look like to be missing for external t

Post 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.
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: Environment variables look like to be missing for extern

Post 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.
patrickz22
Posts: 6
Joined: Thu Mar 23, 2017 6:42 pm

Re: Environment variables look like to be missing for extern

Post 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.
User avatar
Peter
Posts: 1093
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: Environment variables look like to be missing for extern

Post 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
tj1010
Posts: 201
Joined: Wed May 27, 2015 1:36 pm
Contact:

Re: Environment variables look like to be missing for extern

Post 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.
User avatar
T4r4ntul4
Posts: 132
Joined: Wed May 21, 2014 1:57 pm
Location: Netherlands
Contact:

Re: Environment variables look like to be missing for extern

Post 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)
patrickz22
Posts: 6
Joined: Thu Mar 23, 2017 6:42 pm

Re: Environment variables look like to be missing for extern

Post 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.
patrickz22
Posts: 6
Joined: Thu Mar 23, 2017 6:42 pm

Re: Environment variables look like to be missing for extern

Post 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.
Post Reply