February 08, 2013
On 02/07/2013 02:58 PM, Peter Sommerfeld wrote:

> The point is you cannot *set* the path variable.
> But meanwhile I think it isn't a good idea anyway.
> The PATH belongs to the user/system, not to programs.
> Otherwise that may introduce some harm...

The environment is private to the running process (unless some of the variables are "exported" to child processes of that process.) There is no danger of affecting the system.

Ali

February 08, 2013
Ali Çehreli wrote:

> On 02/07/2013 02:58 PM, Peter Sommerfeld wrote:
>
>  > The point is you cannot *set* the path variable.
>  > But meanwhile I think it isn't a good idea anyway.
>  > The PATH belongs to the user/system, not to programs.
>  > Otherwise that may introduce some harm...
>
> The environment is private to the running process (unless some of the variables are "exported" to child processes of that process.) There is no danger of affecting the system.

Regarding the PATH win7 seems not to thinks so. May be on *nix?

Peter
February 08, 2013
On 02/07/2013 04:37 PM, Peter Sommerfeld wrote:
> Ali Çehreli wrote:
>
>> On 02/07/2013 02:58 PM, Peter Sommerfeld wrote:
>>
>> > The point is you cannot *set* the path variable.
>> > But meanwhile I think it isn't a good idea anyway.
>> > The PATH belongs to the user/system, not to programs.
>> > Otherwise that may introduce some harm...
>>
>> The environment is private to the running process (unless some of the
>> variables are "exported" to child processes of that process.) There is
>> no danger of affecting the system.
>
> Regarding the PATH win7 seems not to thinks so. May be on *nix?
>
> Peter

We are talking about changing the PATH environment variable from inside a program right? I don't use win7 so I have to take your word for it but I am very surprised.

I would understand if we are talking about changing the PATH variable that gets copied to the environment of each process but setting the variable in a process should stay with that process.

Ali

February 08, 2013
On Thu, 07 Feb 2013 20:45:49 -0500, Ali Çehreli <acehreli@yahoo.com> wrote:

> On 02/07/2013 04:37 PM, Peter Sommerfeld wrote:
>  > Ali Çehreli wrote:
>  >
>  >> On 02/07/2013 02:58 PM, Peter Sommerfeld wrote:
>  >>
>  >> > The point is you cannot *set* the path variable.
>  >> > But meanwhile I think it isn't a good idea anyway.
>  >> > The PATH belongs to the user/system, not to programs.
>  >> > Otherwise that may introduce some harm...
>  >>
>  >> The environment is private to the running process (unless some of the
>  >> variables are "exported" to child processes of that process.) There is
>  >> no danger of affecting the system.
>  >
>  > Regarding the PATH win7 seems not to thinks so. May be on *nix?
>  >
>  > Peter
>
> We are talking about changing the PATH environment variable from inside a program right? I don't use win7 so I have to take your word for it but I am very surprised.

"exporting" is a feature of the shell in unix.  Exporting means that the
variable will be copied to child processes, and does NOT affect parent
processes or any other processes.  It is private to the process, and is
"passed on" to children (via one of the exec functions).  If the parent
changes the variable after passing to the child, the child's copy does not
change.

Windows is actually EXACTLY the same, except you don't use getenv and putenv, you use SetEnvironmentVariable and GetEnvironmentVariable.  You can use the former if you want to use the C compatibility layer, but that's only if you use all compatibility layer functions for everything (executing processes etc.)

See here http://msdn.microsoft.com/en-us/library/windows/desktop/ms682653(v=vs.85).aspx

Likely the reason why the call is failing is because of an incorrect implementation in phobos.

-Steve
February 08, 2013
Steven Schveighoffer schrieb:
> Windows is actually EXACTLY the same, except you don't use getenv and putenv, you use SetEnvironmentVariable and GetEnvironmentVariable.  You can use the former if you want to use the C compatibility layer, but that's only if you use all compatibility layer functions for everything (executing processes etc.)

How is the latter done ? A Version switch to posix?

Peter
February 08, 2013
On Fri, 08 Feb 2013 04:17:02 -0500, Peter Sommerfeld <noreply@rubrica.at> wrote:

> Steven Schveighoffer schrieb:
>> Windows is actually EXACTLY the same, except you don't use getenv and putenv, you use SetEnvironmentVariable and GetEnvironmentVariable.  You can use the former if you want to use the C compatibility layer, but that's only if you use all compatibility layer functions for everything (executing processes etc.)
>
> How is the latter done ? A Version switch to posix?

Actually, D on Windows uses DMC as its C runtime, so you cannot use any MSVC C runtime functions, such as _putenv.  So this is not an option for you.

If DMC has equivalent functions, you will have to look them up.

-Steve
February 10, 2013
> I'm trying to write a script in D for building D projects.



They are dbuilder who do this . you can fork it https://github.com/dbuilder-developers/dbuilder
1 2
Next ›   Last »