Skip to content

Commit

Permalink
Merge pull request #53826 from dotnet/merges/release/dev16.11-to-rele…
Browse files Browse the repository at this point in the history
…ase/dev16.11-vs-deps

Merge release/dev16.11 to release/dev16.11-vs-deps
  • Loading branch information
msftbot[bot] authored Jun 2, 2021
2 parents e8851c9 + 7791927 commit 757770c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,21 @@ public void CombinePaths_DifferentFromPathCombine(string expected, string path1,
{
Assert.Equal(expected, PathUtilities.CombinePaths(path1, path2));
}

[ConditionalFact(typeof(WindowsOnly)), WorkItem(51602, @"https://github.com/dotnet/roslyn/issues/51602")]
public void GetRelativePath_EnsureNo_IndexOutOfRangeException_Windows()
{
var expected = "";
var result = PathUtilities.GetRelativePath(@"C:\A\B\", @"C:\A\B");
Assert.Equal(expected, result);
}

[ConditionalFact(typeof(UnixLikeOnly)), WorkItem(51602, @"https://github.com/dotnet/roslyn/issues/51602")]
public void GetRelativePath_EnsureNo_IndexOutOfRangeException_Unix()
{
var expected = "";
var result = PathUtilities.GetRelativePath(@"/A/B/", @"/A/B");
Assert.Equal(expected, result);
}
}
}
3 changes: 3 additions & 0 deletions src/Compilers/Core/Portable/FileSystem/PathUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,9 @@ public static string GetRelativePath(string directory, string fullPath)
{
string relativePath = string.Empty;

directory = TrimTrailingSeparators(directory);
fullPath = TrimTrailingSeparators(fullPath);

if (IsChildPath(directory, fullPath))
{
return GetRelativeChildPath(directory, fullPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// < auto-generated />
#nullable enable
using System;
using System.ComponentModel;
using Microsoft.CodeAnalysis.FlowAnalysis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ private void WriteFiles()
}
}

using (_writer = new StreamWriter(File.Open(Path.Combine(_location, "OperationKind.Generated.cs"), FileMode.Create), Encoding.UTF8))
{
writeHeader();
WriteUsing("System");
WriteUsing("System.ComponentModel");
WriteUsing("Microsoft.CodeAnalysis.FlowAnalysis");
WriteUsing("Microsoft.CodeAnalysis.Operations");

WriteStartNamespace(namespaceSuffix: null);

WriteOperationKind();

WriteEndNamespace();
}

void writeHeader()
{
WriteLine("// Licensed to the .NET Foundation under one or more agreements.");
Expand Down

0 comments on commit 757770c

Please sign in to comment.