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

refactor: use echo to write manifest on flatpak

This commit is contained in:
2026-02-26 13:24:58 +05:30
Verified
parent 953bd20499
commit b3d99f3334
3 changed files with 19 additions and 9 deletions

View File

@@ -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 {