feat(core): micropython 板卡文件管理 右键菜单添加 剪切复制粘贴 选项

This commit is contained in:
王立帮
2025-08-24 04:33:08 +08:00
parent 16a72f1773
commit 4f26f8e9f4
14 changed files with 299 additions and 35 deletions

View File

@@ -125,9 +125,29 @@ class AmpyFS extends FS {
return this.rename(oldFilePath, newFilePath);
}
// async moveFile(oldFilePath, newFilePath) {}
async moveFile(oldFilePath, newFilePath) {
return this.rename(oldFilePath, newFilePath);
}
// async copyFile(oldFilePath, newFilePath) {}
async copyFile(oldFilePath, newFilePath) {
let stdout = '', error = null, ampy = null;
try {
ampy = await this.getAmpy();
await ampy.enter();
stdout = await ampy.cpfile(oldFilePath, newFilePath);
} catch (e) {
error = e;
Debug.error(error);
}
try {
await ampy.exit();
await ampy.dispose();
} catch (e) {
error = e;
Debug.error(error);
}
return [error, stdout];
}
async deleteFile(filePath) {
let stdout = '', error = null, ampy = null;
@@ -206,9 +226,29 @@ class AmpyFS extends FS {
return this.rename(oldFolderPath, newFolderPath);
}
// async moveDirectory(oldFolderPath, newFolderPath) {}
async moveDirectory(oldFolderPath, newFolderPath) {
return this.rename(oldFolderPath, newFolderPath);
}
// async copyDirectory(oldFolderPath, newFolderPath) {}
async copyDirectory(oldFolderPath, newFolderPath) {
let stdout = '', error = null, ampy = null;
try {
ampy = await this.getAmpy();
await ampy.enter();
stdout = await ampy.cpdir(oldFolderPath, newFolderPath);
} catch (e) {
error = e;
Debug.error(error);
}
try {
await ampy.exit();
await ampy.dispose();
} catch (e) {
error = e;
Debug.error(error);
}
return [error, stdout];
}
async deleteDirectory(folderPath) {
let stdout = '', error = null, ampy = null;