Skip to content
This repository was archived by the owner on Nov 1, 2020. It is now read-only.

Implement GetEnvironmentVariable and ExpandEnvironmentStrings on Windows#147

Merged
AlexGhiondea merged 1 commit into
dotnet:masterfrom
AlexGhiondea:EnvVars
Oct 30, 2015
Merged

Implement GetEnvironmentVariable and ExpandEnvironmentStrings on Windows#147
AlexGhiondea merged 1 commit into
dotnet:masterfrom
AlexGhiondea:EnvVars

Conversation

@AlexGhiondea
Copy link
Copy Markdown
Contributor

The change refactors the Environment.EnvironmentVariables into 3 parts:

  • Environment.EnvironmentVariables.UWP.cs
    -> This contains the implementations that we want to carry over for UWP apps
  • Environment.EnvironmentVariables.Win32.cs
    -> This contains the implementation we want to have for CoreRT on Windows
  • Environment.EnvironmentVariables.Unix.cs
    -> This contains the implementation we want to have for CoreRT on Unix

I have also introduced 2 Interop files (Win32 and Unix) that will contain the
corresponding PInvokes.

Partially fixes #6

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look how the interop definitions are structured in corefx. I think we may want to do the same thing here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed this to Interop.Sys. ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/interop-guidelines.md, it should be class Interop { class mincore, the file should live under Common, and the filename should be something like Interop.Environment.cs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was unaware we had interop guidelines spelled out!
Thanks for the link!

Will update according to them.

Alex

From: Jan Kotas [mailto:notifications@github.com]
Sent: Thursday, October 29, 2015 12:25 PM
To: dotnet/corert corert@noreply.github.com
Cc: Alexandru Ghiondea Ghiondea.Alexandru@microsoft.com
Subject: Re: [corert] Implement GetEnvironmentVariable and ExpandEnvironmentStrings on Windows (#147)

In src/System.Private.CoreLib/src/Interop/Interop.Win32.cshttps://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithub.com%2fdotnet%2fcorert%2fpull%2f147%23discussion_r43432571&data=01%7c01%7cghiondea.alexandru%40microsoft.com%7c3d3295ebf3e64e44e3ae08d2e096a154%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=t1LGWRhWVYY87yotQU6hJM3MspR2Ra6tEowJqP0PIeM%3d:

@@ -0,0 +1,19 @@

+// Copyright (c) Microsoft. All rights reserved.

+// Licensed under the MIT license. See LICENSE file in the project root for full license information.

+using System;

+using System.Runtime.CompilerServices;

+using System.Runtime.InteropServices;

+internal partial class Interop

+{

  • internal unsafe partial class Environment
  • {

According to https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/interop-guidelines.mdhttps://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithub.com%2fdotnet%2fcorefx%2fblob%2fmaster%2fDocumentation%2fcoding-guidelines%2finterop-guidelines.md&data=01%7c01%7cghiondea.alexandru%40microsoft.com%7c3d3295ebf3e64e44e3ae08d2e096a154%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=Zyi9xOWsvYXSCIC9ISm4bF%2f32GS54ntVo4dURmszkRc%3d, it should be class Interop { class mincore, the file should live under Common, and the filename should be something like Interop.Environment.cs


Reply to this email directly or view it on GitHubhttps://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithub.com%2fdotnet%2fcorert%2fpull%2f147%2ffiles%23r43432571&data=01%7c01%7cghiondea.alexandru%40microsoft.com%7c3d3295ebf3e64e44e3ae08d2e096a154%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=9PMKP3BHP4B%2b802jcdCXeglcmJBglMNic9IVgXOXtXs%3d.

@AlexGhiondea
Copy link
Copy Markdown
Contributor Author

Will rebase and squash before I merge this in.

@AlexGhiondea
Copy link
Copy Markdown
Contributor Author

Added the missing commit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to throw here too?

@tarekgh
Copy link
Copy Markdown
Member

tarekgh commented Oct 29, 2015

add some little comment but other than that LGTM

…ows.

The change refactors the Environment.EnvironmentVariables into 3 parts:
- Environment.EnvironmentVariables.UWP.cs
  -> This contains the implementations that we want to carry over for UWP apps
- Environment.EnvironmentVariables.Win32.cs
  -> This contains the implementation we want to have for CoreRT on Windows
- Environment.EnvironmentVariables.Unix.cs
  -> This contains the implementation we want to have for CoreRT on Unix

I have also introduced 2 Interop files (Win32 and Unix) that will contain the
corresponding PInvokes.
AlexGhiondea added a commit that referenced this pull request Oct 30, 2015
Implement GetEnvironmentVariable and ExpandEnvironmentStrings on Windows
@AlexGhiondea AlexGhiondea merged commit 462ff29 into dotnet:master Oct 30, 2015
@AlexGhiondea AlexGhiondea deleted the EnvVars branch October 30, 2015 17:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CoreLib doesn't implement Environment.GetEnvironmentVariable and friends

4 participants