Skip to content

Commit ba967c8

Browse files
committed
support 'global' locationType for custom flasher
1 parent 93b3b47 commit ba967c8

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

src/EIDEProjectExplorer.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6516,13 +6516,22 @@ export class ProjectExplorer implements CustomConfigurationProvider {
65166516
let needReload = false;
65176517
if (tarFlasher.resources[osType()]) {
65186518

6519-
if (cancel.isCancellationRequested) return;
6519+
if (cancel.isCancellationRequested)
6520+
return;
65206521

65216522
const res = tarFlasher.resources[osType()];
6522-
let installDir = res.locationType == 'global' ? new File(resManager.getEideToolsInstallDir()) : project.getRootDir();
6523-
if (res.locationType == 'workspace') installDir = File.fromArray([project.getRootDir().path, res.location]);
65246523

6525-
if (res.zipType != 'none') {
6524+
let installDir: File;
6525+
let isFirstInstall: boolean = false;
6526+
6527+
if (res.locationType == 'workspace')
6528+
installDir = File.fromArray([project.getRootDir().path, res.location]);
6529+
else // global
6530+
installDir = File.fromArray([resManager.getEideToolsInstallDir(), res.location]);
6531+
6532+
// if have a resource and not install, download it
6533+
if (res.zipType != 'none' && installDir.IsDir() == false) {
6534+
65266535
reporter.report({ message: 'downloading resources' });
65276536
const buf = await downloadFile(redirectHost(res.url));
65286537
if (!(buf instanceof Buffer)) throw buf || new Error('Cannot download resource');
@@ -6534,6 +6543,8 @@ export class ProjectExplorer implements CustomConfigurationProvider {
65346543
const szip = new SevenZipper();
65356544
const r = szip.UnzipSync(new File(tmpPath), installDir);
65366545
GlobalEvent.emit('globalLog', newMessage('Info', r));
6546+
6547+
isFirstInstall = true;
65376548
}
65386549

65396550
if (res.setupCommand) {
@@ -6549,7 +6560,7 @@ export class ProjectExplorer implements CustomConfigurationProvider {
65496560
}
65506561
}
65516562

6552-
needReload = res.locationType == 'global';
6563+
needReload = isFirstInstall && res.locationType == 'global';
65536564
}
65546565

65556566
if (cancel.isCancellationRequested) {

src/WebInterface/WebInterface.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ export interface ShellFlasherIndexItem {
163163
locationType: 'workspace' | 'global';
164164

165165
/**
166-
* if 'locationType' == 'workspace', this field means tool install path
166+
* if 'locationType' == 'workspace', Install Dir is '${workspaceFolder}/<location>'
167167
*
168-
* if 'locationType' == 'global', this field means tool exe file dir path
168+
* if 'locationType' == 'global', Install Dir is '${userHome}/.eide/tools/<location>'
169169
*/
170170
location: string;
171171

0 commit comments

Comments
 (0)