|
|
@@ -40,6 +40,18 @@ class UtilsController extends Controller {
|
|
|
*/
|
|
|
async shellFun (params) {
|
|
|
console.log(params)
|
|
|
+ // 如果是打开路径操作,确保路径存在
|
|
|
+ if (params.action === 'openPath') {
|
|
|
+ try {
|
|
|
+ // 确保目录存在,如果不存在就创建
|
|
|
+ if (!fs.existsSync(params.params)) {
|
|
|
+ fs.mkdirSync(params.params, { recursive: true });
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.error('创建目录失败:', err);
|
|
|
+ // 即使创建目录失败,也尝试打开路径(可能已经存在)
|
|
|
+ }
|
|
|
+ }
|
|
|
shell[params.action](params.params)
|
|
|
}
|
|
|
|