Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion codeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,20 @@ import (
func loadCodeServer(ctx context.Context) (string, error) {
start := time.Now()

cachePath := filepath.Join(os.TempDir(), "sail-code-server-cache/code-server")
var cachePath string
const codeServerPathSuffix = "sail-code-server-cache/code-server"
// MacOS maps os.TempDir() to `/var/folders/...`, which isn't shared with the docker
// system since docker tries to comply with Apple's filesystem sandbox guidelines, so
// default to `/tmp` when on MacOS.
//
// See:
// https://stackoverflow.com/questions/45122459/docker-mounts-denied-the-paths-are-not-shared-from-os-x-and-are-not-known
switch runtime.GOOS {
case "darwin":
cachePath = filepath.Join("/tmp", codeServerPathSuffix)
default:
cachePath = filepath.Join(os.TempDir(), codeServerPathSuffix)
}

// downloadURLPath stores the download URL, so we know whether we should update
// the binary.
Expand Down