FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cli/src/spec-utils/workspaces.ts at main · v-Mathiyarasy/cli · GitHub
v-Mathiyarasy
/
cli
Public
forked from
devcontainers/cli
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cli
/
src
/
spec-utils
/
workspaces.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
35 lines (31 loc) · 1.33 KB
Breadcrumbs
cli
/
src
/
spec-utils
/
workspaces.ts
Copy path
File metadata and controls
35 lines (31 loc) · 1.33 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
path
from
'path'
;
export
interface
Workspace
{
readonly
isWorkspaceFile
:
boolean
;
readonly
workspaceOrFolderPath
:
string
;
readonly
rootFolderPath
:
string
;
readonly
configFolderPath
:
string
;
}
export
function
workspaceFromPath
(
path_
:
typeof
path
.
posix
|
typeof
path
.
win32
,
workspaceOrFolderPath
:
string
)
:
Workspace
{
if
(
isWorkspacePath
(
workspaceOrFolderPath
)
)
{
const
workspaceFolder
=
path_
.
dirname
(
workspaceOrFolderPath
)
;
return
{
isWorkspaceFile
:
true
,
workspaceOrFolderPath
,
rootFolderPath
:
workspaceFolder
,
// use workspaceFolder as root folder
configFolderPath
:
workspaceFolder
,
// have config file in workspaceFolder (to be discussed...)
}
;
}
return
{
isWorkspaceFile
:
false
,
workspaceOrFolderPath
,
rootFolderPath
:
workspaceOrFolderPath
,
configFolderPath
:
workspaceOrFolderPath
,
}
;
}
export
function
isWorkspacePath
(
workspaceOrFolderPath
:
string
)
{
return
path
.
extname
(
workspaceOrFolderPath
)
===
'.code-workspace'
;
// TODO: Remove VS Code specific code.
}
Back
|
FazBrowse Home
|
New Git URL