Skip to content

Commit 31d1516

Browse files
committed
check dep root when install component
1 parent d321eb5 commit 31d1516

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/DependenceManager.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ export class DependenceManager implements ManagerInterface {
6868

6969
InstallComponent(packName: string, component: Component, clearDir: boolean = true) {
7070

71+
// try add dep root to project before install a component
72+
this.tryAddCompRootDirToProject();
73+
7174
const config = this.project.GetConfiguration();
7275
const toolchain = this.project.getToolchain();
7376

@@ -239,7 +242,7 @@ export class DependenceManager implements ManagerInterface {
239242

240243
getDependenceRootFolder(): File {
241244
if (this.depDir === undefined) {
242-
throw new Error('depDir is undefined');
245+
throw new Error('eide depDir is undefined');
243246
}
244247
return this.depDir;
245248
}
@@ -318,6 +321,14 @@ export class DependenceManager implements ManagerInterface {
318321

319322
//--
320323

324+
private tryAddCompRootDirToProject() {
325+
const depRoot = this.getDependenceRootFolder();
326+
if (!depRoot.IsDir()) depRoot.CreateDir(false);
327+
const prjConfig = this.project.GetConfiguration();
328+
prjConfig.addSrcDirAtFirst(depRoot.path);
329+
prjConfig.CustomDep_AddIncDir(depRoot);
330+
}
331+
321332
private getDepDir(): File {
322333
this.depDir?.CreateDir(false);
323334
return <File>this.depDir;

0 commit comments

Comments
 (0)