From 9474112067250f2b334cd29d8f3d9a0b59e8c15f Mon Sep 17 00:00:00 2001 From: Matthew Nibecker Date: Thu, 28 Sep 2023 11:19:03 -0500 Subject: [PATCH] feedback --- cli/lakeflags/datadir.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/cli/lakeflags/datadir.go b/cli/lakeflags/datadir.go index 9ac5662d26..1cd5d19971 100644 --- a/cli/lakeflags/datadir.go +++ b/cli/lakeflags/datadir.go @@ -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