Skip to content

Commit

Permalink
feat: Write cache file as part of init
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeine-addictt committed Apr 13, 2024
1 parent a3fea1b commit 73f974f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,18 @@ func initConfig() {
})

Debug("Loaded configuration from " + viper.ConfigFileUsed())

// Making caching file `$HOME/.video-manager_history`
Debug("Writing cache file if it does not exist at " + home + "/.video-manager_history")
file, err := os.OpenFile(filepath.Clean(filepath.Join(home, ".video-manager_history")), os.O_RDWR|os.O_CREATE, 0o600)
if err != nil {
fmt.Println("Failed to write cache file at " + home + "/.video-manager_history")
Debug(err.Error())
os.Exit(1)
}
defer file.Close()

Debug("Ensured cache file exists at " + home + "/.video-manager_history")
}

func Execute() {
Expand Down

0 comments on commit 73f974f

Please sign in to comment.