fix(plugins): rename & match removeFileF logic with other platforms (#1806)

This commit is contained in:
エリス
2025-06-16 21:29:02 +09:00
committed by GitHub
parent 7a47fe01dc
commit 5dc9c72821
3 changed files with 36 additions and 36 deletions

View File

@@ -42,7 +42,7 @@ const handlers = {
deleteJava(project.projectDir, dest);
} else {
// Just remove the file, not the whole parent directory
removeFile(path.resolve(project.projectDir, dest));
removeFileF(path.resolve(project.projectDir, dest));
}
}
},
@@ -53,7 +53,7 @@ const handlers = {
},
uninstall: function (obj, plugin, project, options) {
const dest = path.join('app/libs', path.basename(obj.src));
removeFile(path.resolve(project.projectDir, dest));
removeFileF(path.resolve(project.projectDir, dest));
}
},
'resource-file': {
@@ -63,7 +63,7 @@ const handlers = {
},
uninstall: function (obj, plugin, project, options) {
const dest = path.join('app', 'src', 'main', obj.target);
removeFile(path.resolve(project.projectDir, dest));
removeFileF(path.resolve(project.projectDir, dest));
}
},
framework: {
@@ -102,7 +102,7 @@ const handlers = {
if (obj.custom) {
const subRelativeDir = project.getCustomSubprojectRelativeDir(plugin.id, src);
removeFile(path.resolve(project.projectDir, subRelativeDir));
removeFileF(path.resolve(project.projectDir, subRelativeDir));
subDir = path.resolve(project.projectDir, subRelativeDir);
// If it's the last framework in the plugin, remove the parent directory.
const parDir = path.dirname(subDir);
@@ -247,8 +247,8 @@ function symlinkFileOrDirTree (src, dest) {
}
}
function removeFile (file) {
fs.rmSync(file);
function removeFileF (file) {
fs.rmSync(file, { recursive: true, force: true });
}
// Sometimes we want to remove some java, and prune any unnecessary empty directories
@@ -261,7 +261,7 @@ function removeFileAndParents (baseDir, destFile, stopper) {
const file = path.resolve(baseDir, destFile);
if (!fs.existsSync(file)) return;
removeFile(file);
removeFileF(file);
// check if directory is empty
let curDir = path.dirname(file);