Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 52f2bf0

Browse files
committed
Rename to Paths.ToWindowsPath from ToRelativePath
ToWindowsPath is clearer because it doesn't convert from an absolute path.
1 parent 286d287 commit 52f2bf0

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/GitHub.App/Services/GitHubContextService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public bool TryOpenFile(string repositoryDir, GitHubContext context)
282282
return false;
283283
}
284284

285-
var relativePath = Paths.ToRelativePath(path);
285+
var relativePath = Paths.ToWindowsPath(path);
286286
var fullPath = Path.Combine(repositoryDir, relativePath);
287287
var textView = OpenDocument(fullPath);
288288
SetSelection(textView, context);

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ async Task<string> GetBaseFileName(IPullRequestSession session, IPullRequestSess
638638
var gitPath = Paths.ToGitPath(file.RelativePath);
639639
var fileChange = changes.FirstOrDefault(x => x.Path == gitPath);
640640
return fileChange?.Status == LibGit2Sharp.ChangeKind.Renamed ?
641-
Paths.ToRelativePath(fileChange.OldPath) : file.RelativePath;
641+
Paths.ToWindowsPath(fileChange.OldPath) : file.RelativePath;
642642
}
643643
}
644644

src/GitHub.App/ViewModels/GitHubPane/PullRequestDirectoryNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class PullRequestDirectoryNode : IPullRequestDirectoryNode
1717
public PullRequestDirectoryNode(string relativeOrGitPath)
1818
{
1919
DirectoryName = System.IO.Path.GetFileName(relativeOrGitPath);
20-
RelativePath = Paths.ToRelativePath(relativeOrGitPath);
20+
RelativePath = Paths.ToWindowsPath(relativeOrGitPath);
2121
Directories = new List<IPullRequestDirectoryNode>();
2222
Files = new List<IPullRequestFileNode>();
2323
}

src/GitHub.App/ViewModels/GitHubPane/PullRequestFileNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public PullRequestFileNode(
4242
Guard.ArgumentNotEmptyString(sha, nameof(sha));
4343

4444
FileName = Path.GetFileName(relativeOrGitPath);
45-
RelativePath = Paths.ToRelativePath(relativeOrGitPath);
45+
RelativePath = Paths.ToWindowsPath(relativeOrGitPath);
4646
Sha = sha;
4747
Status = status;
4848
OldPath = oldPath;

src/GitHub.Exports/Primitives/Paths.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ public static string ToGitPath(string relativePath)
2121
}
2222

2323
/// <summary>
24-
/// Convert from a Git path to a relative path.
24+
/// Convert from a Git path to a path that uses the Windows directory separator ('\').
2525
/// </summary>
26-
/// <param name="gitPath">A working directory relative path which uses the '/' directory separator.</param>
27-
/// <returns>A relative paht that uses the <see cref="Path.DirectorySeparatorChar"/> directory separator.</returns>
28-
public static string ToRelativePath(string gitPath)
26+
/// <param name="gitPath">A relative path that uses the '/' directory separator.</param>
27+
/// <returns>A relative path that uses the <see cref="Path.DirectorySeparatorChar"/> directory separator ('\' on Windows).</returns>
28+
public static string ToWindowsPath(string gitPath)
2929
{
3030
return gitPath.Replace(GitDirectorySeparatorChar, Path.DirectorySeparatorChar);
3131
}

0 commit comments

Comments
 (0)