@@ -239,15 +239,18 @@ class KeilProject implements IView, KeilProjectInfo {
protected _event: event.EventEmitter;
protected watcher: FileWatcher;
protected targetList: Target[];
- constructor(_uvprjFile: File) {
+ constructor(_uvprjFile: File, ws_path?: string) {
this._event = new event.EventEmitter();
this.uVsionFileInfo = <uVisonInfo>{};
this.targetList = [];
- this.vscodeDir = new File(_uvprjFile.dir + File.sep + '.vscode');
+ if (!ws_path) {
+ ws_path = _uvprjFile.dir;
+ }
+ this.vscodeDir = new File(ws_path + File.sep + '.vscode');
this.vscodeDir.CreateDir();
const logPath = this.vscodeDir.path + File.sep + 'keil-assistant.log';
this.logger = new console.Console(fs.createWriteStream(logPath, { flags: 'a+' }));
this.uvprjFile = _uvprjFile;
this.watcher = new FileWatcher(this.uvprjFile);
@@ -1185,26 +1188,26 @@ class ProjectExplorer implements vscode.TreeDataProvider<IView> {
const wsFilePath: string = vscode.workspace.workspaceFile && /^file:/.test(vscode.workspace.workspaceFile.toString()) ?
node_path.dirname(vscode.workspace.workspaceFile.fsPath) : vscode.workspace.workspaceFolders[0].uri.fsPath;
const workspace = new File(wsFilePath);
if (workspace.IsDir()) {
const excludeList = ResourceManager.getInstance().getProjectExcludeList();
- const uvList = workspace.GetList([/\.uvproj[x]?$/i], File.EMPTY_FILTER)
+ const uvList = workspace.GetAll([/\.uvproj[x]?$/i], File.EMPTY_FILTER)
.filter((file) => { return !excludeList.includes(file.name); });
for (const uvFile of uvList) {
try {
- await this.openProject(uvFile.path);
+ await this.openProject(uvFile.path, wsFilePath);
} catch (error) {
vscode.window.showErrorMessage(`open project: '${uvFile.name}' failed !, msg: ${(<Error>error).message}`);
}
}
}
}
}
- async openProject(path: string): Promise<KeilProject | undefined> {
+ async openProject(path: string, ws_path?: string): Promise<KeilProject | undefined> {
- const nPrj = new KeilProject(new File(path));
+ const nPrj = new KeilProject(new File(path), ws_path);
if (!this.prjList.has(nPrj.prjID)) {
await nPrj.load();
nPrj.on('dataChanged', () => this.updateView());
this.prjList.set(nPrj.prjID, nPrj);