Compare commits
1 Commits
v0.2.1
...
9fce9cf2a1
Author | SHA1 | Date | |
---|---|---|---|
9fce9cf2a1 |
5
main.go
5
main.go
@@ -7,7 +7,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -78,11 +77,11 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
// Check if config exists. If it doesn't, generate the config files.
|
// Check if config exists. If it doesn't, generate the config files.
|
||||||
currentUser, err := user.Current() // Get current user, to determine config path
|
userHomeDir, err := os.UserHomeDir() // Get current user's home directory, to construct config path
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
configPath := filepath.Join("/home/" + currentUser.Username + "/.config/ccat/")
|
configPath := filepath.Join(userHomeDir + "/.config/ccat/")
|
||||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||||
generateDefaultConfigs(configPath)
|
generateDefaultConfigs(configPath)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user