mirror of
https://github.com/neosubhamoy/neodlp.git
synced 2026-03-22 09:05:49 +05:30
refactor: use cp instead of fs api on flatpak
This commit is contained in:
@@ -64,6 +64,11 @@
|
|||||||
"name": "powershell",
|
"name": "powershell",
|
||||||
"cmd": "powershell",
|
"cmd": "powershell",
|
||||||
"args": true
|
"args": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cp",
|
||||||
|
"cmd": "cp",
|
||||||
|
"args": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -114,6 +119,11 @@
|
|||||||
"name": "deno",
|
"name": "deno",
|
||||||
"cmd": "deno",
|
"cmd": "deno",
|
||||||
"args": true
|
"args": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cp",
|
||||||
|
"cmd": "cp",
|
||||||
|
"args": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useKvPairs } from "@/helpers/use-kvpairs";
|
|||||||
import { useSettingsPageStatesStore } from "@/services/store";
|
import { useSettingsPageStatesStore } from "@/services/store";
|
||||||
import { invoke } from "@tauri-apps/api/core";
|
import { invoke } from "@tauri-apps/api/core";
|
||||||
import { useLogger } from "@/helpers/use-logger";
|
import { useLogger } from "@/helpers/use-logger";
|
||||||
|
import { Command } from "@tauri-apps/plugin-shell";
|
||||||
|
|
||||||
interface FileMap {
|
interface FileMap {
|
||||||
source: string;
|
source: string;
|
||||||
@@ -41,12 +42,22 @@ export function useLinuxRegisterer() {
|
|||||||
const sourcePath = await join(resourceDirPath, file.source);
|
const sourcePath = await join(resourceDirPath, file.source);
|
||||||
// const destinationDir = await join(homeDirPath, file.dir);
|
// const destinationDir = await join(homeDirPath, file.dir);
|
||||||
const destinationPath = await join(homeDirPath, file.destination);
|
const destinationPath = await join(homeDirPath, file.destination);
|
||||||
|
const command = Command.create('cp', [sourcePath, destinationPath]);
|
||||||
|
|
||||||
|
const output = await command.execute();
|
||||||
|
if (output.code === 0) {
|
||||||
|
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
|
||||||
|
LOG.info("LINUX REGISTERER", `File ${file.source} copied successfully to ${destinationPath}`);
|
||||||
|
} 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}`);
|
||||||
|
}
|
||||||
|
|
||||||
// const dirExists = await fs.exists(destinationDir);
|
// const dirExists = await fs.exists(destinationDir);
|
||||||
// if (dirExists) {
|
// if (dirExists) {
|
||||||
await fs.copyFile(sourcePath, destinationPath);
|
// await fs.copyFile(sourcePath, destinationPath);
|
||||||
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}`);
|
||||||
// } else {
|
// } else {
|
||||||
// await fs.mkdir(destinationDir, { recursive: true })
|
// await fs.mkdir(destinationDir, { recursive: true })
|
||||||
// console.log(`Created dir ${destinationDir}`);
|
// console.log(`Created dir ${destinationDir}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user