浏览代码

Fixes pathing issue on Windows

main
Eric Amodio 7 年前
父节点
当前提交
305674d71a
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. +10
    -6
      src/git/git.ts

+ 10
- 6
src/git/git.ts 查看文件

@ -47,13 +47,17 @@ export default class Git {
}
static splitPath(fileName: string, repoPath?: string): [string, string] {
// if (!path.isAbsolute(fileName)) {
// Logger.error(`Git.splitPath(${fileName}) is not an absolute path!`);
// debugger;
// }
if (repoPath) return [fileName.replace(`${repoPath}/`, ''), repoPath];
if (repoPath) {
return [
fileName.replace(repoPath.endsWith('/') ? repoPath : `${repoPath}/`, ''),
repoPath
];
}
return [path.basename(fileName).replace(/\\/g, '/'), path.dirname(fileName).replace(/\\/g, '/')];
return [
path.basename(fileName).replace(/\\/g, '/'),
path.dirname(fileName).replace(/\\/g, '/')
];
}
static async repoPath(cwd: string, gitPath?: string) {

正在加载...
取消
保存