Skip to content

Commit

Permalink
create dir w/ tool name under .config
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancanbakir committed Jul 18, 2023
1 parent fd29b62 commit c49e6d6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions goflags.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ func (flagSet *FlagSet) migrateConfigDir() {
// 2. new config dir doesn't exist
// 3. old config dir is not same as new config dir

if flagSet.GetToolConfigDir() != oldAppConfigDir && fileutil.FolderExists(oldAppConfigDir) && !fileutil.FolderExists(flagSet.GetToolConfigDir()) {
toolConfigDir := flagSet.GetToolConfigDir()
if toolConfigDir != oldAppConfigDir && fileutil.FolderExists(oldAppConfigDir) && !fileutil.FolderExists(toolConfigDir) {
_ = fileutil.CreateFolder(toolConfigDir)
// move old config dir to new one
_ = folderutil.SyncDirectory(oldAppConfigDir, flagSet.GetToolConfigDir())
_ = folderutil.SyncDirectory(oldAppConfigDir, toolConfigDir)
}
}

Expand Down

0 comments on commit c49e6d6

Please sign in to comment.