Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mattnibs committed Sep 28, 2023
1 parent e4103dd commit ff88fe9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
18 changes: 5 additions & 13 deletions cli/lakeflags/datadir.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,15 @@ func getDefaultDataDir() string {
}
switch runtime.GOOS {
case "windows":
// Windows XP and before didn't have a LOCALAPPDATA, so fallback
// to regular APPDATA when LOCALAPPDATA is not set.
appData := os.Getenv("LOCALAPPDATA")
if appData == "" {
appData = os.Getenv("APPDATA")
}
if appData != "" {
if appData := os.Getenv("LOCALAPPDATA"); appData != "" {
return filepath.Join(appData, "zed")
}
case "darwin":
if homeDir != "" {
return filepath.Join(homeDir, "Library",
"Application Support", "zed")
}
default:
if homeDir != "" {
return filepath.Join(homeDir, ".zed")
// For linux and windows 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
Expand Down
2 changes: 1 addition & 1 deletion cli/lakeflags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func portInUse(port string) bool {
func (l *Flags) Open(ctx context.Context) (api.Interface, error) {
// If the lake is the defaultDataDir, first check if a service is running
// on port 9867 and if so, use this as the lake location.
if l.Lake == defaultDataDir && !portInUse("9867") {
if l.Lake == defaultDataDir && portInUse("9867") {
l.Lake = "http://localhost:9867"
}
uri, err := l.URI()
Expand Down

0 comments on commit ff88fe9

Please sign in to comment.