From eb52a37f7762d0f5cffe5c7e3d98ae67cd64b09e Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Fri, 28 Jun 2019 10:29:56 +0200 Subject: [PATCH] strip data-volume prefix from CWD on Catalina --- terminus-terminal/src/services/sessions.service.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/terminus-terminal/src/services/sessions.service.ts b/terminus-terminal/src/services/sessions.service.ts index f8a4ec1a..16ad0381 100644 --- a/terminus-terminal/src/services/sessions.service.ts +++ b/terminus-terminal/src/services/sessions.service.ts @@ -28,6 +28,7 @@ export interface ChildProcess { } const windowsDirectoryRegex = /([a-zA-Z]:[^\:\[\]\?\"\<\>\|]+)/mi +const catalinaDataVolumePrefix = '/System/Volumes/Data' const OSC1337Prefix = '\x1b]1337;' const OSC1337Suffix = '\x07' @@ -282,11 +283,11 @@ export class Session extends BaseSession { } catch (e) { return null } - if (lines[1] === 'fcwd') { - return lines[2].substring(1) - } else { - return lines[1].substring(1) + let cwd = lines[(lines[1] === 'fcwd') ? 2 : 1].substring(1) + if (cwd.startsWith(catalinaDataVolumePrefix)) { + cwd = cwd.substring(catalinaDataVolumePrefix.length) } + return cwd } if (process.platform === 'linux') { return fs.readlink(`/proc/${this.truePID}/cwd`)