77using System . Threading . Tasks ;
88using EnvDTE ;
99using GitHub . Commands ;
10+ using GitHub . Primitives ;
1011using GitHub . Extensions ;
1112using GitHub . Models ;
1213using GitHub . Models . Drafts ;
@@ -482,7 +483,7 @@ public static int FindNearestMatchingLine(IList<string> fromLines, IList<string>
482483 static string GetAbsolutePath ( LocalRepositoryModel localRepository , string relativePath )
483484 {
484485 var localPath = localRepository . LocalPath ;
485- relativePath = relativePath . Replace ( '/' , Path . DirectorySeparatorChar ) ;
486+ relativePath = Paths . ToRelativePath ( relativePath ) ;
486487 return Path . Combine ( localPath , relativePath ) ;
487488 }
488489
@@ -491,7 +492,7 @@ static string ToGitPath(LocalRepositoryModel localRepository, string path)
491492 var basePath = localRepository . LocalPath + Path . DirectorySeparatorChar ;
492493 if ( path . StartsWith ( basePath , StringComparison . OrdinalIgnoreCase ) )
493494 {
494- return path . Substring ( basePath . Length ) . Replace ( Path . DirectorySeparatorChar , '/' ) ;
495+ return Paths . ToGitPath ( path . Substring ( basePath . Length ) ) ;
495496 }
496497
497498 throw new ArgumentException ( $ "Path '{ path } ' is not in the working directory '{ localRepository . LocalPath } '") ;
@@ -654,10 +655,10 @@ async Task<string> GetBaseFileName(IPullRequestSession session, IPullRequestSess
654655 session . LocalRepository ,
655656 session . PullRequest ) )
656657 {
657- var gitPath = file . RelativePath . Replace ( Path . DirectorySeparatorChar , '/' ) ;
658+ var gitPath = Paths . ToGitPath ( file . RelativePath ) ;
658659 var fileChange = changes . FirstOrDefault ( x => x . Path == gitPath ) ;
659660 return fileChange ? . Status == LibGit2Sharp . ChangeKind . Renamed ?
660- fileChange . OldPath . Replace ( '/' , Path . DirectorySeparatorChar ) : file . RelativePath ;
661+ Paths . ToRelativePath ( fileChange . OldPath ) : file . RelativePath ;
661662 }
662663 }
663664
0 commit comments