-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mozzle: Use windows equivalent to linux's $HOME when on windows
Otherwise the CF CLI config.json file will not be found: mozzle: error reading CF CLI config: error open ".cf\config.json": open .cf\config.json: The system cannot find the path specified. Fixes #16.
- Loading branch information
Showing
3 changed files
with
41 additions
and
5 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,18 @@ | ||
// +build !windows | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func homeDir() string { | ||
var homeDir string | ||
switch { | ||
case os.Getenv("CF_HOME") != "": | ||
homeDir = os.Getenv("CF_HOME") | ||
default: | ||
homeDir = os.Getenv("HOME") | ||
} | ||
return homeDir | ||
} |
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,22 @@ | ||
// +build windows | ||
|
||
package main | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
func homeDir() string { | ||
var homeDir string | ||
switch { | ||
case os.Getenv("CF_HOME") != "": | ||
homeDir = os.Getenv("CF_HOME") | ||
case os.Getenv("HOMEDRIVE")+os.Getenv("HOMEPATH") != "": | ||
homeDir = os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") | ||
default: | ||
homeDir = os.Getenv("USERPROFILE") | ||
} | ||
|
||
return homeDir | ||
|
||
} |
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