-
Notifications
You must be signed in to change notification settings - Fork 282
/
mount_paths.go
63 lines (51 loc) · 1.15 KB
/
mount_paths.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package build
import "strings"
type mountPaths struct {
volume string
separator string
workspace string
}
func mountPathsForOS(os, workspace string) mountPaths {
if workspace == "" {
workspace = "workspace"
}
if os == "windows" {
return mountPaths{
volume: `c:`,
separator: `\`,
workspace: workspace,
}
}
return mountPaths{
volume: "",
separator: "/",
workspace: workspace,
}
}
func (m mountPaths) join(parts ...string) string {
return strings.Join(parts, m.separator)
}
func (m mountPaths) layersDir() string {
return m.join(m.volume, "layers")
}
func (m mountPaths) stackPath() string {
return m.join(m.layersDir(), "stack.toml")
}
func (m mountPaths) projectPath() string {
return m.join(m.layersDir(), "project-metadata.toml")
}
func (m mountPaths) appDirName() string {
return m.workspace
}
func (m mountPaths) appDir() string {
return m.join(m.volume, m.appDirName())
}
func (m mountPaths) cacheDir() string {
return m.join(m.volume, "cache")
}
func (m mountPaths) launchCacheDir() string {
return m.join(m.volume, "launch-cache")
}
func (m mountPaths) sbomDir() string {
return m.join(m.volume, "layers", "sbom")
}