mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-14 20:59:27 +00:00
Fixed default workspace and empty ws init
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import * as fs from 'fs-extra';
|
||||
import { injectable } from 'inversify';
|
||||
import { FileUri } from '@theia/core/lib/node/file-uri';
|
||||
import { DefaultWorkspaceServer } from '@theia/workspace/lib/node/default-workspace-server';
|
||||
@@ -8,30 +7,8 @@ import { DefaultWorkspaceServer } from '@theia/workspace/lib/node/default-worksp
|
||||
@injectable()
|
||||
export class DefaultWorkspaceServerExt extends DefaultWorkspaceServer {
|
||||
|
||||
/**
|
||||
* Reads the most recently used workspace root from the user's home directory.
|
||||
*/
|
||||
// tslint:disable-next-line:no-any
|
||||
protected async readRecentWorkspacePathsFromUserHome(): Promise<any> {
|
||||
const paths = await super.readRecentWorkspacePathsFromUserHome();
|
||||
if (!paths || paths.recentRoots.length === 0) {
|
||||
const defaultWorkspacePath = path.resolve(os.homedir(), 'Arduino-PoC', 'workspace');
|
||||
if (!fs.existsSync(defaultWorkspacePath)) {
|
||||
fs.mkdirpSync(defaultWorkspacePath);
|
||||
}
|
||||
return {
|
||||
recentRoots: [
|
||||
FileUri.create(defaultWorkspacePath)
|
||||
]
|
||||
};
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
async getMostRecentlyUsedWorkspace(): Promise<string | undefined> {
|
||||
const result = await super.getMostRecentlyUsedWorkspace();
|
||||
console.log(result);
|
||||
return result;
|
||||
protected async getWorkspaceURIFromCli(): Promise<string | undefined> {
|
||||
return FileUri.create(path.join(os.homedir(), 'Arduino-PoC', 'Sketches')).toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user