123456789101112131415161718192021 |
- const fs = require('fs-extra');
- const path = require('path');
- const appFolderPath = path.join(__dirname, './outApp/HelloWorld-win32-x64/resources/app');
- // 检查文件夹是否存在
- fs.pathExists(appFolderPath)
- .then((exists) => {
- if (exists) {
- // 删除文件夹
- return fs.remove(appFolderPath);
- }
- console.log(appFolderPath + ' 文件夹不存在,无需删除。');
- return Promise.resolve();
- })
- .then(() => {
- console.log(appFolderPath + ' 文件夹已成功删除。');
- })
- .catch((err) => {
- console.error('删除 ' + appFolderPath + ' 文件夹时出错:', err);
- });
|