Skip to content

Commit 893f221

Browse files
committed
Normalize separators as well
1 parent dd42f8b commit 893f221

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

Packages/com.unity.ide.visualstudio.tests/Tests/Editor/AssemblyNameProviderTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void SetUp()
3737
[TestCase(@"Temp\bin\Debug\Player\", "AssemblyName.Player", "AssemblyName.Player.Player")]
3838
public void GetOutputPath_ReturnsPlayerAndeditorOutputPath(string assemblyOutputPath, string assemblyName, string expectedAssemblyName)
3939
{
40-
Assert.AreEqual(expectedAssemblyName, m_AssemblyNameProvider.GetAssemblyName(assemblyOutputPath, assemblyName));
40+
Assert.AreEqual(expectedAssemblyName, m_AssemblyNameProvider.GetAssemblyName(assemblyOutputPath.NormalizePathSeparators(), assemblyName));
4141
}
4242

4343
[Test]
@@ -49,7 +49,7 @@ public void AllEditorAssemblies_AreCollected()
4949

5050
foreach (Assembly editorAssembly in editorAssemblies)
5151
{
52-
Assert.IsTrue(collectedAssemblies.Any(assembly => assembly.name == editorAssembly.name && assembly.outputPath == @"Temp\bin\Debug\"), $"{editorAssembly.name}: was not found in collection.");
52+
Assert.IsTrue(collectedAssemblies.Any(assembly => assembly.name == editorAssembly.name && assembly.outputPath == AssemblyNameProvider.AssemblyOutput), $"{editorAssembly.name}: was not found in collection.");
5353
}
5454
}
5555

@@ -91,7 +91,7 @@ public void PlayerAssemblies_AreNotCollected_BeforeToggling()
9191

9292
foreach (Assembly playerAssembly in playerAssemblies)
9393
{
94-
Assert.IsFalse(collectedAssemblies.Any(assembly => assembly.name == playerAssembly.name && assembly.outputPath == @"Temp\bin\Debug\Player\"), $"{playerAssembly.name}: was found in collection.");
94+
Assert.IsFalse(collectedAssemblies.Any(assembly => assembly.name == playerAssembly.name && assembly.outputPath == AssemblyNameProvider.PlayerAssemblyOutput), $"{playerAssembly.name}: was found in collection.");
9595
}
9696
}
9797

@@ -106,7 +106,7 @@ public void AllPlayerAssemblies_AreCollected_AfterToggling()
106106

107107
foreach (Assembly playerAssembly in playerAssemblies)
108108
{
109-
Assert.IsTrue(collectedAssemblies.Any(assembly => assembly.name == playerAssembly.name && assembly.outputPath == @"Temp\bin\Debug\Player\"), $"{playerAssembly.name}: was not found in collection.");
109+
Assert.IsTrue(collectedAssemblies.Any(assembly => assembly.name == playerAssembly.name && assembly.outputPath == AssemblyNameProvider.PlayerAssemblyOutput), $"{playerAssembly.name}: was not found in collection.");
110110
}
111111
}
112112

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/AssemblyNameProvider.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,18 @@ public string GetAssemblyNameFromScriptPath(string path)
6161
return CompilationPipeline.GetAssemblyNameFromScriptPath(path);
6262
}
6363

64+
internal static readonly string AssemblyOutput = @"Temp\bin\Debug\".NormalizePathSeparators();
65+
internal static readonly string PlayerAssemblyOutput = @"Temp\bin\Debug\Player\".NormalizePathSeparators();
66+
6467
public IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution)
6568
{
66-
IEnumerable<Assembly> assemblies = GetAssembliesByType(AssembliesType.Editor, shouldFileBePartOfSolution, @"Temp\bin\Debug\");
69+
IEnumerable<Assembly> assemblies = GetAssembliesByType(AssembliesType.Editor, shouldFileBePartOfSolution, AssemblyOutput);
6770

6871
if (!ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.PlayerAssemblies))
6972
{
7073
return assemblies;
7174
}
72-
var playerAssemblies = GetAssembliesByType(AssembliesType.Player, shouldFileBePartOfSolution, @"Temp\bin\Debug\Player\");
75+
var playerAssemblies = GetAssembliesByType(AssembliesType.Player, shouldFileBePartOfSolution, PlayerAssemblyOutput);
7376
return assemblies.Concat(playerAssemblies);
7477
}
7578

@@ -208,7 +211,7 @@ public void ResetProjectGenerationFlag()
208211

209212
public string GetAssemblyName(string assemblyOutputPath, string assemblyName)
210213
{
211-
return assemblyOutputPath.EndsWith(@"\Player\", StringComparison.Ordinal) ? assemblyName + ".Player" : assemblyName;
214+
return assemblyOutputPath.EndsWith(@"\Player\".NormalizePathSeparators(), StringComparison.Ordinal) ? assemblyName + ".Player" : assemblyName;
212215
}
213216
}
214217
}

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/ProjectGeneration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ internal static void GetProjectHeaderConfigurations(ProjectProperties properties
786786
headerBuilder.Append(@" <PropertyGroup Condition="" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "">").Append(k_WindowsNewline);
787787
headerBuilder.Append(@" <DebugType>pdbonly</DebugType>").Append(k_WindowsNewline);
788788
headerBuilder.Append(@" <Optimize>true</Optimize>").Append(k_WindowsNewline);
789-
headerBuilder.Append(@" <OutputPath>Temp\bin\Release\</OutputPath>").Append(k_WindowsNewline);
789+
headerBuilder.Append($" <OutputPath>{@"Temp\bin\Release\".NormalizePathSeparators()}</OutputPath>").Append(k_WindowsNewline);
790790
headerBuilder.Append(@" <ErrorReport>prompt</ErrorReport>").Append(k_WindowsNewline);
791791
headerBuilder.Append(@" <WarningLevel>4</WarningLevel>").Append(k_WindowsNewline);
792792
headerBuilder.Append(@" <NoWarn>").Append(NoWarn).Append("</NoWarn>").Append(k_WindowsNewline);

Packages/com.unity.ide.visualstudio/Editor/ProjectGeneration/SdkStyleProjectGeneration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal override void GetProjectHeader(ProjectProperties properties, out String
5959
// We need a dedicated subfolder for each project in obj, else depending on the build order, nuget cache files could be overwritten
6060
// We need to do this before common.props, else we'll have a MSB3539 The value of the property "BaseIntermediateOutputPath" was modified after it was used by MSBuild
6161
headerBuilder.Append(@" <PropertyGroup>").Append(k_WindowsNewline);
62-
headerBuilder.Append(@" <BaseIntermediateOutputPath>Temp/obj/$(Configuration)/$(MSBuildProjectName)</BaseIntermediateOutputPath>").Append(k_WindowsNewline);
62+
headerBuilder.Append($" <BaseIntermediateOutputPath>{@"Temp\obj\$(Configuration)\$(MSBuildProjectName)".NormalizePathSeparators()}</BaseIntermediateOutputPath>").Append(k_WindowsNewline);
6363
headerBuilder.Append(@" <IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>").Append(k_WindowsNewline);
6464
headerBuilder.Append(@" </PropertyGroup>").Append(k_WindowsNewline);
6565

0 commit comments

Comments
 (0)