feat(core): micropython 板卡文件管理 右键菜单添加 剪切 、复制 和 粘贴 选项
This commit is contained in:
@@ -106,9 +106,21 @@ 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;
|
||||
try {
|
||||
const output = await this.#ampy_.cpfile(this.#port_, this.#baud_, oldFilePath, newFilePath);
|
||||
stdout = output.stdout;
|
||||
} catch (e) {
|
||||
error = e;
|
||||
Debug.error(error);
|
||||
}
|
||||
return [error, stdout];
|
||||
}
|
||||
|
||||
async deleteFile(filePath) {
|
||||
let stdout = '', error = null;
|
||||
@@ -179,9 +191,21 @@ 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;
|
||||
try {
|
||||
const output = await this.#ampy_.cpdir(this.#port_, this.#baud_, oldFolderPath, newFolderPath);
|
||||
stdout = output.stdout;
|
||||
} catch (e) {
|
||||
error = e;
|
||||
Debug.error(error);
|
||||
}
|
||||
return [error, stdout];
|
||||
}
|
||||
|
||||
async deleteDirectory(folderPath) {
|
||||
let stdout = '', error = null;
|
||||
|
||||
@@ -33,6 +33,8 @@ class AmpyExt extends Ampy {
|
||||
rm: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 rm "{{&filePath}}"',
|
||||
rmdir: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 rmdir "{{&folderPath}}"',
|
||||
rename: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 rename "{{&oldPath}}" "{{&newPath}}"',
|
||||
cpdir: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 cpdir "{{&startPath}}" "{{&endPath}}"',
|
||||
cpfile: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 cpfile "{{&startPath}}" "{{&endPath}}"',
|
||||
run: '{{&y}} -p {{&port}} -b {{&baud}} -i 0 run "{{&filePath}}"'
|
||||
}
|
||||
|
||||
@@ -90,6 +92,14 @@ class AmpyExt extends Ampy {
|
||||
return this.exec(port, this.render('rename', { port, baud, oldPath, newPath }));
|
||||
}
|
||||
|
||||
async cpdir(port, baud, startPath, endPath) {
|
||||
return this.exec(port, this.render('cpdir', { port, baud, startPath, endPath }));
|
||||
}
|
||||
|
||||
async cpfile(port, baud, startPath, endPath) {
|
||||
return this.exec(port, this.render('cpfile', { port, baud, startPath, endPath }));
|
||||
}
|
||||
|
||||
async run(port, baud, filePath) {
|
||||
return this.exec(port, this.render('run', { port, baud, filePath }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user