Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Commit

Permalink
Ensure code-server cache path is mountable on MacOS (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Potter authored Jun 11, 2019
1 parent 8195b9e commit 2125c9e
Showing 1 changed file with 14 additions and 1 deletion.
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

0 comments on commit 2125c9e

Please sign in to comment.