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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user