1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Improve the config file handling process

* Don't create a default config if a custom config is being passed in
* Textfile: don't die if the file cannot be found
This commit is contained in:
Chris Cummer
2019-08-02 01:49:05 -07:00
parent 45da40e4c9
commit 4c2b52cdbb
3 changed files with 28 additions and 13 deletions

View File

@@ -57,12 +57,20 @@ func CreateFile(fileName string) (string, error) {
// Initialize takes care of settings up the initial state of WTF configuration
// It ensures necessary directories and files exist
func Initialize() {
migrateOldConfig()
func Initialize(hasCustom bool) {
if hasCustom == false {
migrateOldConfig()
}
// These always get created because this is where modules should write any permanent
// data they need to persist between runs (i.e.: log, textfile, etc.)
createXdgConfigDir()
createWtfConfigDir()
createWtfConfigFile()
chmodConfigFile()
if hasCustom == false {
createWtfConfigFile()
chmodConfigFile()
}
}
// WtfConfigDir returns the absolute path to the configuration directory