-
Notifications
You must be signed in to change notification settings - Fork 526
Expand file tree
/
Copy pathworkspace.ts
More file actions
63 lines (58 loc) · 2.22 KB
/
workspace.ts
File metadata and controls
63 lines (58 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Module for dealing with multiple workspace directories
*/ /** */
import * as vscode from 'vscode';
import { ConfigurationReader } from '@cmt/config';
import paths from '@cmt/paths';
import { StateManager } from '@cmt/state';
/**
* State attached to a directory in a workspace. Contains a config object and
* a state management object.
*/
export class DirectoryContext {
constructor(
/**
* Workspace folder associated with this context
*/
public readonly folder: vscode.WorkspaceFolder,
/**
* The configuration for the associated directory.
*/
public readonly config: ConfigurationReader,
/**
* The state management object associated with the directory.
*/
public readonly state: StateManager
) {}
/**
* Create a context object for the given a workspace folder.
* @param folder The workspace folder for which to create a context
* @param state The state that will be associated with the returned context
*/
static createForDirectory(folder: vscode.WorkspaceFolder, state: StateManager): DirectoryContext {
const config = ConfigurationReader.create(folder);
return new DirectoryContext(folder, config, state);
}
/**
* The path to a CMake executable associated with this directory. This should
* be used over `ConfigurationReader.cmakePath` because it will do additional
* path expansion and searching.
*/
getCMakePath(overWriteCMakePathSetting?: string, searchPATH?: string): Promise<string | null> {
return paths.getCMakePath(this, overWriteCMakePathSetting, searchPATH);
}
/**
* The CTest executable for the directory. See `cmakePath` for more
* information.
*/
getCTestPath(overWriteCMakePathSetting?: string, searchPATH?: string): Promise<string | null> {
return paths.getCTestPath(this, overWriteCMakePathSetting, searchPATH);
}
/**
* The CPack executable for the directory. See `cmakePath` for more
* information.
*/
getCPackPath(overWriteCMakePathSetting?: string, searchPATH?: string): Promise<string | null> {
return paths.getCPackPath(this, overWriteCMakePathSetting, searchPATH);
}
}