Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions app/src/lib/helpers/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function convertToFlatpakPath(path: string) {
return path
}

if (path.startsWith('/opt/')) {
if (path.startsWith('/opt/') || path.startsWith('/var/lib/flatpak')) {
return path
}

Expand All @@ -31,6 +31,13 @@ export function convertToFlatpakPath(path: string) {
export function formatWorkingDirectoryForFlatpak(path: string): string {
return path.replace(/(\s)/, ' ')
}

export function formatPathForFlatpak(path: string): string {
if (path.startsWith('/var/lib/flatpak/app')) {
return path.replace('/var/lib/flatpak/app/', '')
}
return path
}
/**
* Checks the file path on disk exists before attempting to launch a specific shell
*
Expand Down Expand Up @@ -84,12 +91,13 @@ export function spawnEditor(
options: SpawnOptions
): ChildProcess {
if (isFlatpakBuild()) {
const actualpath = formatPathForFlatpak(path)
const EscapedworkingDirectory = formatWorkingDirectoryForFlatpak(
workingDirectory
)
return spawn(
'flatpak-spawn',
['--host', path, EscapedworkingDirectory],
['--host', actualpath, EscapedworkingDirectory],
options
)
} else {
Expand Down