mirror of
https://github.com/desktop/desktop
synced 2024-10-03 23:03:52 +00:00
Trim correctly on both Windows and Posix
This commit is contained in:
parent
ab48d526da
commit
4f33cd66ea
|
@ -141,10 +141,10 @@ export function truncatePath(path: string, length: number) {
|
|||
export function extract(
|
||||
normalizedPath: string
|
||||
): { normalizedFileName: string; normalizedDirectory: string } {
|
||||
// for untracked submodules, the status entry is returned as a directory,
|
||||
// with a trailing / which causes the directory to be trimmed in a weird way
|
||||
// below. let's try and resolve this here
|
||||
normalizedPath = normalizedPath.endsWith('/')
|
||||
// for directories the status entry is returned as a path with a trailing
|
||||
// which causes the directory to be trimmed in a weird way below. let's try
|
||||
// and resolve this here
|
||||
normalizedPath = normalizedPath.endsWith(Path.sep)
|
||||
? normalizedPath.substr(0, normalizedPath.length - 1)
|
||||
: normalizedPath
|
||||
|
||||
|
|
Loading…
Reference in a new issue