[Mono-list] Unable to get environment variable
Jason Perkins
starkos at gmail.com
Mon Mar 12 16:22:15 EDT 2007
On 3/11/07, William Huskey <william.huskey at gmail.com> wrote:
> would this not work
>
> OperatingSystem os = Environment.OSVersion;
> Console.WriteLine(os.VersionString);
No, I'm afraid that doesn't work. On MacOS X, os.VersionString returns
"Unix 8.8.2.0". I haven't been able to figure out OSTYPE is coming
back null, so I'm leaning toward attempting to DllImport a system
library and catching the error if it doesn't exist.
Better ideas welcome! And thanks for responding.
Jason
> On 3/8/07, Jason Perkins <starkos at gmail.com> wrote:
> >
> > I'm new to non-MS platforms, so my apologies if this isn't a mono
> > specific question.
> >
> > I've got mono running on my new OS X box. I am trying to add some code
> > to my application to detect the platform. I thought it would be as
> > easy as calling
> Environment.GetEnvironmentVariable("OSTYPE") and
> > parsing the result, but the call always returns null, even though
> > typing `echo $OSTYPE` at a shell prompt returns `darwin8.0`.
> >
> > Any idea what I'm doing wrong here? Many thanks!
> >
> > Jason
> > _______________________________________________
> > Mono-list maillist - Mono-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-list
> >
>
>
>
> --
> William S. Huskey
>
> UNIX Systems Engineer
>
> Maritime Systems Solutions Division
>
> SAIC
>
> Tel: 425-267-5643
>
> Email: huskeyw at saic.com
More information about the Mono-list
mailing list