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