-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If no lake location is specified, zed will use a per-os default location. Also if the default location is used, zed will first check if there's a service on 9867 and opt to connect to that instead of operating locally.
- Loading branch information
Showing
7 changed files
with
80 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package lakeflags | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
) | ||
|
||
var defaultDataDir string | ||
|
||
func init() { | ||
defaultDataDir = getDefaultDataDir() | ||
} | ||
|
||
// getDefaultDataDir returns the default data directory for the current user. | ||
// Derived from https://github.com/btcsuite/btcd/blob/master/btcutil/appdata.go | ||
func getDefaultDataDir() string { | ||
// Resolve the XDG data home directory if set. | ||
if xdgDataHome := os.Getenv("XDG_DATA_HOME"); xdgDataHome != "" { | ||
return filepath.Join(xdgDataHome, "zed") | ||
} | ||
if runtime.GOOS == "windows" { | ||
if appData := os.Getenv("LOCALAPPDATA"); appData != "" { | ||
return filepath.Join(appData, "zed") | ||
} | ||
} | ||
if homeDir, _ := os.UserHomeDir(); homeDir != "" { | ||
// Follow the XDG spec which states: | ||
// If $XDG_DATA_HOME is either not set or empty, a default equal to | ||
// $HOME/.local/share should be used. | ||
return filepath.Join(homeDir, ".local", "share", "zed") | ||
} | ||
// Return an empty string which will cause an error if a default data | ||
// directory cannot be found. | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
script: | | ||
! zed ls -lake '' | ||
! zed serve | ||
! zed serve -lake '' | ||
outputs: | ||
- name: stderr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
script: | | ||
export XDG_DATA_HOME=path/to/lake | ||
zed init | ||
outputs: | ||
- name: stdout | ||
data: | | ||
lake created: path/to/lake/zed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
script: | | ||
! zc -C -s 'from p' | ||
! zc -lake='' -C -s 'from p' | ||
echo === >&2 | ||
export ZED_LAKE=test | ||
zed init | ||
|