From db4b3a6083ba0ea98066122d5d01ad463cb29e71 Mon Sep 17 00:00:00 2001 From: Sergei Vorobev Date: Wed, 29 Jun 2016 14:28:09 -0700 Subject: [PATCH] Make DefineTypes aware of / as a path delimiter on non-windows systems --- src/System.Management.Automation/engine/parser/PSType.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/System.Management.Automation/engine/parser/PSType.cs b/src/System.Management.Automation/engine/parser/PSType.cs index c846f9bf8..3d42739a2 100644 --- a/src/System.Management.Automation/engine/parser/PSType.cs +++ b/src/System.Management.Automation/engine/parser/PSType.cs @@ -1124,7 +1124,10 @@ namespace System.Management.Automation.Language // Two replaces at the end are for not-allowed characters. They are replaced by similar-looking chars. string assemblyName = ClrFacade.FIRST_CHAR_PSASSEMBLY_MARK + (string.IsNullOrWhiteSpace(rootAst.Extent.File) ? "powershell" - : rootAst.Extent.File.Replace('\\', (char)0x29f9).Replace(':', (char)0x0589)); + : rootAst.Extent.File + .Replace('\\', (char)0x29f9) + .Replace('/', (char)0x29f9) + .Replace(':', (char)0x0589)); var assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(assemblyName), AssemblyBuilderAccess.RunAndCollect, GetAssemblyAttributeBuilders());