Skip to content

Commit 377380d

Browse files
authored
clean legacy unify_builder
1 parent 6484d22 commit 377380d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/extension.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ async function checkAndInstallBinaries(forceInstall?: boolean): Promise<boolean>
465465
process.env['EIDE_BINARIES_VER'] = localVersion;
466466
}
467467

468+
// clean legacy builder/bin folder
469+
cleanLegacyUnifyBuilder();
470+
468471
return true;
469472
}
470473

@@ -734,13 +737,13 @@ function onBinariesInstallDone() {
734737
}
735738

736739
// delete legacy builder dir
740+
cleanLegacyUnifyBuilder();
741+
}
742+
743+
function cleanLegacyUnifyBuilder() {
737744
const legacyDir = File.fromArray([resManager.getLegacyBuilderDir().path, 'bin']);
738745
if (legacyDir.IsDir()) {
739-
platform.DeleteAllChildren(legacyDir);
740-
fs.writeFileSync(legacyDir.path + '/' + 'NOTICE.TXT',
741-
[`unify_builder has been moved to '${resManager.getUnifyBuilderExe().dir}, this folder is deprecated'`,
742-
`---`,
743-
`unify_builder 的位置已被转移到 '${resManager.getUnifyBuilderExe().dir}',该位置已被弃用`].join(os.EOL));
746+
platform.DeleteDir(legacyDir);
744747
}
745748
}
746749

@@ -972,7 +975,7 @@ async function checkAndInstallRuntime() {
972975
const pkgSha256 = sevenZip.sha256(pkgFile);
973976
const reqSha256 = 'A085714B879DC1CB85538109640E22A2CBFF2B91195DF540A5F98AEA09AF2C1E'.toLowerCase();
974977
if (pkgSha256 == reqSha256) { pkgReady = true; } // sha256 verified, use cached old file
975-
else { try { fs.unlinkSync(pkgFile.path); } catch{ } } // sha256 verify failed, del old file
978+
else { try { fs.unlinkSync(pkgFile.path); } catch { } } // sha256 verify failed, del old file
976979
}
977980

978981
if (!pkgReady) { // if no cached pkg, download it
@@ -1555,7 +1558,7 @@ class MapViewEditorProvider implements vscode.CustomTextEditorProvider {
15551558
}
15561559

15571560
if (!isSupported) {
1558-
webviewPanel.webview.html = this.genHtmlCont(title,
1561+
webviewPanel.webview.html = this.genHtmlCont(title,
15591562
`<span class="error">Error</span>: We don't support this toolchain type: '${conf.tool}' yet !`);
15601563
return;
15611564
}
@@ -1675,7 +1678,7 @@ class MapViewEditorProvider implements vscode.CustomTextEditorProvider {
16751678

16761679
if (toolchain.parseMapFile) {
16771680
let ret = toolchain.parseMapFile(vInfo.mapPath);
1678-
if (ret instanceof Error)
1681+
if (ret instanceof Error)
16791682
throw ret;
16801683
else
16811684
lines = ret;

0 commit comments

Comments
 (0)