promote lib manage
This commit is contained in:
parent
52349329df
commit
6ef036fa78
@ -1,5 +1,6 @@
|
||||
import * as assert from 'assert';
|
||||
import * as fs from 'fs';
|
||||
import { hdlFile } from '../hdlFs';
|
||||
|
||||
import { Arch, PrjInfo, RawPrjInfo, resolve, toSlash } from './prjInfo';
|
||||
|
||||
@ -141,6 +142,22 @@ class OpeParam {
|
||||
public resolvePathExtension(relPath: RelPath): AbsPath {
|
||||
return resolve(this._extensionPath, relPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* get User's property.json
|
||||
*/
|
||||
public getUserPrjInfo() {
|
||||
const propertyJsonPath = this.propertyJsonPath;
|
||||
const userPrjInfo = new PrjInfo();
|
||||
if (fs.existsSync(propertyJsonPath)) {
|
||||
const rawPrjInfo = hdlFile.readJSON(propertyJsonPath);
|
||||
userPrjInfo.merge(rawPrjInfo);
|
||||
} else {
|
||||
// use default config instead
|
||||
const rawPrjInfo = hdlFile.readJSON(this.propertyInitPath);
|
||||
userPrjInfo.merge(rawPrjInfo);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const opeParam: OpeParam = new OpeParam();
|
||||
|
@ -145,6 +145,8 @@ class LibPick {
|
||||
|
||||
if (selectedPath && hdlPath.exist(selectedPath)) {
|
||||
const ppyPath = hdlPath.join(opeParam.workspacePath, '.vscode', 'property.json');
|
||||
|
||||
// 抽象这块
|
||||
let prjInfo = null;
|
||||
// 如果存在,则读取用户的配置文件,否则使用默认的
|
||||
if (!hdlPath.exist(ppyPath)) {
|
||||
@ -156,7 +158,6 @@ class LibPick {
|
||||
if (selectedPath.includes(this.commonQuickPickItem.path!)) {
|
||||
// this is a module import from common, use relative path
|
||||
const relPath = selectedPath.replace(this.commonQuickPickItem.path + '/', '');
|
||||
|
||||
appendLibraryCommonPath(relPath, prjInfo);
|
||||
} else {
|
||||
// this is a module import from custom, use absolute path
|
||||
|
@ -86,7 +86,6 @@ class PrjManage {
|
||||
public initialise() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const prjManage = new PrjManage();
|
||||
|
Loading…
x
Reference in New Issue
Block a user