-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Can't rely on os/user for x-compiling
- Loading branch information
1 parent
b4f92eb
commit 2b984a2
Showing
6 changed files
with
66 additions
and
61 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 |
---|---|---|
@@ -1,15 +1,21 @@ | ||
package main | ||
|
||
import ( | ||
"os/user" | ||
"os" | ||
"path/filepath" | ||
) | ||
|
||
func configDir() string { | ||
usr, err := user.Current() | ||
if err != nil { | ||
return "" | ||
func getHomeDir() (homeDir string) { | ||
homeDir = os.Getenv("HOME") | ||
if homeDir == "" { | ||
homeDir = getInput("Path to home directory", false) | ||
} | ||
|
||
return filepath.Join(usr.HomeDir, ".config") | ||
return | ||
} | ||
|
||
func getConfigDir() (configDir string) { | ||
configDir = filepath.Join(getHomeDir(), ".config") | ||
|
||
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,14 +1,22 @@ | ||
package main | ||
|
||
import ( | ||
"os/user" | ||
"os" | ||
) | ||
|
||
func configDir() string { | ||
usr, err := user.Current() | ||
if err != nil { | ||
return "" | ||
func getHomeDir() (homeDir string) { | ||
homeDir = os.Getenv("HOMEPATH") | ||
if homeDir == "" { | ||
homeDir = getInput("Path to home directory", false) | ||
} | ||
|
||
return usr.HomeDir | ||
return | ||
} | ||
|
||
func getConfigDir() (configDir string) { | ||
configDir = os.Getenv("APPDATA") | ||
if configDir == "" { | ||
configDir = getInput("Path to config directory", false) | ||
} | ||
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