1
1
mirror of https://github.com/neosubhamoy/neodlp.git synced 2026-03-22 09:05:49 +05:30

refactor: use sh and printf to write

This commit is contained in:
2026-02-26 20:20:57 +05:30
Verified
parent f0e31cd15e
commit 3b234c766e
2 changed files with 6 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ export function useLinuxRegisterer() {
description: "NeoDLP MsgHost",
path: `${homeDirPath}/.local/bin/neodlp-msghost`,
type: "stdio",
allowed_extension: ["neodlp@neosubhamoy.com"]
allowed_extensions: ["neodlp@neosubhamoy.com"]
};
const filesToCopy: FileMap[] = [
@@ -56,8 +56,9 @@ export function useLinuxRegisterer() {
for (const file of filesToCopyFlatpak) {
const sourcePath = await join(resourceDirPath, file.source);
const destinationPath = await join(homeDirPath, file.destination);
const copyCommand = Command.create('cp', [sourcePath, destinationPath]);
const writeCommand = Command.create('echo', [file.content || '', '>', destinationPath]);
const escapedContent = file.content?.replace(/'/g, `'\\''`) || '';
const copyCommand = Command.create('sh', ['-c', 'cp', sourcePath, destinationPath]);
const writeCommand = Command.create('sh', ['-c', `printf '%s' '${escapedContent}' > "${destinationPath}"`]);
if (file.content) {
const writeOutput = await writeCommand.execute();