diff --git a/electron/exposes/adbkit/index.js b/electron/exposes/adbkit/index.js index 5e590f7..e617c41 100644 --- a/electron/exposes/adbkit/index.js +++ b/electron/exposes/adbkit/index.js @@ -225,10 +225,13 @@ async function readdir(id, filePath) { } async function push(id, filePath, args = {}) { - const { progress, savePath = `/sdcard/Download/${path.basename(filePath)}` } - = args + const { progress, savePath = '/sdcard/Download' } = args - const transfer = await client.getDevice(id).push(filePath, savePath) + const fileName = path.basename(filePath) + + const fullSavePath = `${savePath}/${fileName}`.replace(/\/+/g, '/') + + const transfer = await client.getDevice(id).push(filePath, fullSavePath) return new Promise((resolve, reject) => { transfer.on('progress', (stats) => { @@ -236,7 +239,7 @@ async function push(id, filePath, args = {}) { }) transfer.on('end', () => { - resolve(savePath) + resolve(fullSavePath) }) transfer.on('error', (err) => { @@ -246,8 +249,11 @@ async function push(id, filePath, args = {}) { } async function pull(id, filePath, args = {}) { - const { progress, savePath = path.resolve('../', path.basename(filePath)) } - = args + const { progress, savePath = '../' } = args + + const fileName = path.basename(filePath) + + const fullSavePath = path.resolve(savePath, fileName) const transfer = await client.getDevice(id).pull(filePath) @@ -257,14 +263,14 @@ async function pull(id, filePath, args = {}) { }) transfer.on('end', () => { - resolve(savePath) + resolve(fullSavePath) }) transfer.on('error', (err) => { reject(err) }) - transfer.pipe(fs.createWriteStream(savePath)) + transfer.pipe(fs.createWriteStream(fullSavePath)) }) } diff --git a/eslint.config.js b/eslint.config.js index 594baee..bcb5b0a 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -33,6 +33,7 @@ export default antfu( 'antfu/top-level-function': 'off', 'import/default': 'off', + 'import/order': 'off', 'node/prefer-global/process': 'off', diff --git a/src/components/Device/components/ControlBar/FileManage/FileDialog/index.vue b/src/components/Device/components/ControlBar/FileManage/FileDialog/index.vue index e34ef66..a65e534 100644 --- a/src/components/Device/components/ControlBar/FileManage/FileDialog/index.vue +++ b/src/components/Device/components/ControlBar/FileManage/FileDialog/index.vue @@ -168,9 +168,7 @@