Skip to content

Review all if/def and Unix specific code after moving to .NET Core 2.0 #3565

@daxian-dbw

Description

@daxian-dbw

PowerShell Core is moving to .NET Core 2.0 with PR #3556. Once that PR is merged, we need to review all if/def and Unix specific code to:

  • Clean up the code
  • Make sure the code make sense and is not a temporary hack

An Example (Please remove when fixed)

Platform.InternalGetFolderPath in src/System.Management.Automation/CoreCLR/CorePsPlatform.cs has the following code:

                case System.Environment.SpecialFolder.ProgramFiles:
                    folderPath = "/bin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;
                case System.Environment.SpecialFolder.ProgramFilesX86:
                    folderPath = "/usr/bin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;
                case System.Environment.SpecialFolder.System:
                case System.Environment.SpecialFolder.SystemX86:
                    folderPath = "/sbin";
                    if (!System.IO.Directory.Exists(folderPath)) { folderPath = null; }
                    break;

It use /bin for ProgramFiles, /usr/bin for ProgramFilesX86 and /sbin for System and SystemX86. It's not clear if this is appropriate, so code like this should be reviewed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Code Cleanupthe issue is for cleaning up the code with no impact on functionalityResolution-No ActivityIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions