Replaced the relative path on Windows with an absolute path
This commit is contained in:
15
main.go
15
main.go
@@ -78,18 +78,19 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
// Check if config exists. If it doesn't, generate the config files.
|
||||
var configPath string // Location of config files, depends on OS
|
||||
var configPath string // Location of config files, depends on OS
|
||||
currentUser, err := user.Current() // Get current user, to determine config path
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if runningOnWindows() {
|
||||
configPath = "%APPDATA%\\ccat"
|
||||
configPath = filepath.Join("C:\\Users" + currentUser.Username + "AppData\\Local\\ccat\\")
|
||||
} else {
|
||||
currentUser, err := user.Current()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
configPath = filepath.Join("/home/" + currentUser.Username + "/.config/ccat/")
|
||||
}
|
||||
if _, err := os.Stat(configPath); os.IsNotExist(err) {
|
||||
generateDefaultConfigs()
|
||||
generateDefaultConfigs(configPath)
|
||||
}
|
||||
|
||||
// Check if user has provided a file name
|
||||
|
Reference in New Issue
Block a user