MCPcopy Index your code
hub / github.com/devcontainers/cli / workspaceFromPath

Function workspaceFromPath

src/spec-utils/workspaces.ts:15–31  ·  view source on GitHub ↗
(path_: typeof path.posix | typeof path.win32, workspaceOrFolderPath: string)

Source from the content-addressed store, hash-verified

13}
14
15export function workspaceFromPath(path_: typeof path.posix | typeof path.win32, workspaceOrFolderPath: string): Workspace {
16 if (isWorkspacePath(workspaceOrFolderPath)) {
17 const workspaceFolder = path_.dirname(workspaceOrFolderPath);
18 return {
19 isWorkspaceFile: true,
20 workspaceOrFolderPath,
21 rootFolderPath: workspaceFolder, // use workspaceFolder as root folder
22 configFolderPath: workspaceFolder, // have config file in workspaceFolder (to be discussed...)
23 };
24 }
25 return {
26 isWorkspaceFile: false,
27 workspaceOrFolderPath,
28 rootFolderPath: workspaceOrFolderPath,
29 configFolderPath: workspaceOrFolderPath,
30 };
31}
32
33export function isWorkspacePath(workspaceOrFolderPath: string) {
34 return path.extname(workspaceOrFolderPath) === '.code-workspace'; // TODO: Remove VS Code specific code.

Callers 8

featuresUpgradeFunction · 0.90
doBuildFunction · 0.90
doRunUserCommandsFunction · 0.90
readConfigurationFunction · 0.90
outdatedFunction · 0.90
doExecFunction · 0.90
resolveWithLocalFolderFunction · 0.90

Calls 1

isWorkspacePathFunction · 0.85

Tested by

no test coverage detected