How to set path as a variable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set path as a variable

shawon58
In pharo class side , i am creating class side method like as
/*makebox
LibC system: 'D:\DEV_FreeCAD\build\bin\makebox.step'*/
SO i want to set /D:\DEV_FreeCAD\build\bin\ / as a variable like path than i
can write like as
*LibC system: 'path\makebox.step'*

how to do that, if anyone have idea please share the idea with me.

Thanks for your help




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: How to set path as a variable

Christopher Fuhrman-4
Hello,

Why not use the PATH environment variable in Windows to do what you want? I deal with setting variables used with LibC in my blog entry at https://fuhrmanator.github.io/2019/03/16/LibC-Pharo-experiments.html

You can get PATH by using:

    path := OSEnvironment current getEnv: 'PATH'.

Then you can add your directory to it (note that I put a semicolon for path separator in Windows):

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path.

Then you have to set the variable in the system:

    result := OSEnvironment current setEnv: 'PATH' value: modifiedPath.

You should probably get (again) the variable PATH (as above) to make sure the path was set correctly.

Then just do:

    result := LibC runCommand: 'makebox.step'.

Let us know if it works for you.

Cheers!

On Sun, 28 Jun 2020 at 09:03, shawon58 <[hidden email]> wrote:
In pharo class side , i am creating class side method like as
/*makebox
LibC system: 'D:\DEV_FreeCAD\build\bin\makebox.step'*/
SO i want to set /D:\DEV_FreeCAD\build\bin\ / as a variable like path than i
can write like as
*LibC system: 'path\makebox.step'*

how to do that, if anyone have idea please share the idea with me.

Thanks for your help




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



--
Christopher Fuhrman, P.Eng., PhD
Professeur au Département de génie logiciel et des technologies de l'information
ÉTS (École de technologie supérieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'ÉTS est une constituante de l'Université du Québec
Reply | Threaded
Open this post in threaded view
|

Re: How to set path as a variable

Christopher Fuhrman-4
Then you can add your directory to it (note that I put a semicolon for path separator in Windows):

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path. 

My apologies (I have been coding too much JavaScript lately) - this should have been:

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' , path. 

Cheers,
 

On Sun, 28 Jun 2020 at 11:16, Christopher Fuhrman <[hidden email]> wrote:
Hello,

Why not use the PATH environment variable in Windows to do what you want? I deal with setting variables used with LibC in my blog entry at https://fuhrmanator.github.io/2019/03/16/LibC-Pharo-experiments.html

You can get PATH by using:

    path := OSEnvironment current getEnv: 'PATH'.

Then you can add your directory to it (note that I put a semicolon for path separator in Windows):

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path.

Then you have to set the variable in the system:

    result := OSEnvironment current setEnv: 'PATH' value: modifiedPath.

You should probably get (again) the variable PATH (as above) to make sure the path was set correctly.

Then just do:

    result := LibC runCommand: 'makebox.step'.

Let us know if it works for you.

Cheers!

On Sun, 28 Jun 2020 at 09:03, shawon58 <[hidden email]> wrote:
In pharo class side , i am creating class side method like as
/*makebox
LibC system: 'D:\DEV_FreeCAD\build\bin\makebox.step'*/
SO i want to set /D:\DEV_FreeCAD\build\bin\ / as a variable like path than i
can write like as
*LibC system: 'path\makebox.step'*

how to do that, if anyone have idea please share the idea with me.

Thanks for your help




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



--
Christopher Fuhrman, P.Eng., PhD
Professeur au Département de génie logiciel et des technologies de l'information
ÉTS (École de technologie supérieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'ÉTS est une constituante de l'Université du Québec


--
Christopher Fuhrman, P.Eng., PhD
Professeur au Département de génie logiciel et des technologies de l'information
ÉTS (École de technologie supérieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'ÉTS est une constituante de l'Université du Québec
Reply | Threaded
Open this post in threaded view
|

Re: How to set path as a variable

Ben Coman
That is useful to know the PATH variable can be updated for current process.
Nice blog writeup. Thanks Chris.

cheers -ben

On Sun, 28 Jun 2020 at 23:49, Christopher Fuhrman <[hidden email]> wrote:
Then you can add your directory to it (note that I put a semicolon for path separator in Windows):

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path. 

My apologies (I have been coding too much JavaScript lately) - this should have been:

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' , path. 

Cheers,
 

On Sun, 28 Jun 2020 at 11:16, Christopher Fuhrman <[hidden email]> wrote:
Hello,

Why not use the PATH environment variable in Windows to do what you want? I deal with setting variables used with LibC in my blog entry at https://fuhrmanator.github.io/2019/03/16/LibC-Pharo-experiments.html

You can get PATH by using:

    path := OSEnvironment current getEnv: 'PATH'.

Then you can add your directory to it (note that I put a semicolon for path separator in Windows):

    modifiedPath :=  'D:\DEV_FreeCAD\build\bin\;' + path.

Then you have to set the variable in the system:

    result := OSEnvironment current setEnv: 'PATH' value: modifiedPath.

You should probably get (again) the variable PATH (as above) to make sure the path was set correctly.

Then just do:

    result := LibC runCommand: 'makebox.step'.

Let us know if it works for you.

Cheers!

On Sun, 28 Jun 2020 at 09:03, shawon58 <[hidden email]> wrote:
In pharo class side , i am creating class side method like as
/*makebox
LibC system: 'D:\DEV_FreeCAD\build\bin\makebox.step'*/
SO i want to set /D:\DEV_FreeCAD\build\bin\ / as a variable like path than i
can write like as
*LibC system: 'path\makebox.step'*

how to do that, if anyone have idea please share the idea with me.

Thanks for your help




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html



--
Christopher Fuhrman, P.Eng., PhD
Professeur au Département de génie logiciel et des technologies de l'information
ÉTS (École de technologie supérieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'ÉTS est une constituante de l'Université du Québec


--
Christopher Fuhrman, P.Eng., PhD
Professeur au Département de génie logiciel et des technologies de l'information
ÉTS (École de technologie supérieure)

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
L'ÉTS est une constituante de l'Université du Québec