-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathworkspace.go
44 lines (36 loc) · 1.24 KB
/
workspace.go
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
package filepaths
import (
"fmt"
"path"
"strings"
"github.com/turbot/pipe-fittings/v2/app_specific"
"github.com/turbot/pipe-fittings/v2/constants/runtime"
)
// mod related constants
const (
WorkspaceModDir = "mods"
WorkspaceModShadowDirPrefix = ".mods."
WorkspaceConfigFileName = "workspace.spc"
WorkspaceLockFileName = ".mod.cache.json"
)
func WorkspaceModPath(workspacePath string) string {
return path.Join(workspacePath, app_specific.WorkspaceDataDir, WorkspaceModDir)
}
func WorkspaceModShadowPath(workspacePath string) string {
return path.Join(workspacePath, app_specific.WorkspaceDataDir, fmt.Sprintf("%s%s", WorkspaceModShadowDirPrefix, runtime.ExecutionID))
}
func IsModInstallShadowPath(dirName string) bool {
return strings.HasPrefix(dirName, WorkspaceModShadowDirPrefix)
}
func WorkspaceLockPath(workspacePath string) string {
return path.Join(workspacePath, WorkspaceLockFileName)
}
func DefaultVarsFilePath(workspacePath string) string {
return path.Join(workspacePath, app_specific.DefaultVarsFileName)
}
func LegacyDefaultVarsFilePath(workspacePath string) string {
if app_specific.LegacyDefaultVarsFileName == "" {
return ""
}
return path.Join(workspacePath, app_specific.LegacyDefaultVarsFileName)
}