mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-22 10:15:50 +05:30
refactor: use echo to write manifest on flatpak
This commit is contained in:
@@ -24,7 +24,6 @@
|
|||||||
"sql:allow-execute",
|
"sql:allow-execute",
|
||||||
"fs:allow-app-write",
|
"fs:allow-app-write",
|
||||||
"fs:allow-app-write-recursive",
|
"fs:allow-app-write-recursive",
|
||||||
"fs:allow-write-text-file",
|
|
||||||
"updater:default",
|
"updater:default",
|
||||||
"process:default",
|
"process:default",
|
||||||
"clipboard-manager:allow-read-text",
|
"clipboard-manager:allow-read-text",
|
||||||
|
|||||||
@@ -69,6 +69,11 @@
|
|||||||
"name": "cp",
|
"name": "cp",
|
||||||
"cmd": "cp",
|
"cmd": "cp",
|
||||||
"args": true
|
"args": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "echo",
|
||||||
|
"cmd": "echo",
|
||||||
|
"args": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -56,20 +56,26 @@ export function useLinuxRegisterer() {
|
|||||||
for (const file of filesToCopyFlatpak) {
|
for (const file of filesToCopyFlatpak) {
|
||||||
const sourcePath = await join(resourceDirPath, file.source);
|
const sourcePath = await join(resourceDirPath, file.source);
|
||||||
const destinationPath = await join(homeDirPath, file.destination);
|
const destinationPath = await join(homeDirPath, file.destination);
|
||||||
const command = Command.create('cp', [sourcePath, destinationPath]);
|
const copyCommand = Command.create('cp', [sourcePath, destinationPath]);
|
||||||
|
|
||||||
const output = await command.execute();
|
const copyOutput = await copyCommand.execute();
|
||||||
if (output.code === 0) {
|
if (copyOutput.code === 0) {
|
||||||
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
|
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
|
||||||
LOG.info("LINUX REGISTERER", `File ${file.source} copied successfully to ${destinationPath}`);
|
LOG.info("LINUX REGISTERER", `File ${file.source} copied successfully to ${destinationPath}`);
|
||||||
if (file.content) {
|
if (file.content) {
|
||||||
await fs.writeTextFile(destinationPath, file.content);
|
const writeCommand = Command.create('echo', [file.content, '>', destinationPath]);
|
||||||
console.log(`Content for ${file.source} written successfully to ${destinationPath}`);
|
const writeOutput = await writeCommand.execute();
|
||||||
LOG.info("LINUX REGISTERER", `Content for ${file.source} written successfully to ${destinationPath}`);
|
if (writeOutput.code === 0) {
|
||||||
|
console.log(`Content written successfully to ${destinationPath}`);
|
||||||
|
LOG.info("LINUX REGISTERER", `Content written successfully to ${destinationPath}`);
|
||||||
|
} else {
|
||||||
|
console.error(`Failed to write content to ${destinationPath}:`, writeOutput.stderr);
|
||||||
|
LOG.error("LINUX REGISTERER", `Failed to write content to ${destinationPath}: ${writeOutput.stderr}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.error(`Failed to copy file ${file.source} to ${destinationPath}:`, output.stderr);
|
console.error(`Failed to copy file ${file.source} to ${destinationPath}:`, copyOutput.stderr);
|
||||||
LOG.error("LINUX REGISTERER", `Failed to copy file ${file.source} to ${destinationPath}: ${output.stderr}`);
|
LOG.error("LINUX REGISTERER", `Failed to copy file ${file.source} to ${destinationPath}: ${copyOutput.stderr}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user