Fixed CLI db path

This commit is contained in:
Neeraj Gupta 2023-10-30 10:36:34 +05:30
parent d3c60b7f9d
commit bb415850cb

10
main.go
View file

@ -19,7 +19,15 @@ func main() {
if err != nil {
log.Fatalf("Could not create cli config path\n%v\n", err)
}
db, err := pkg.GetDB(fmt.Sprintf("%sente-cli.db", cliDBPath))
oldCliPath := fmt.Sprintf("%sente-cli.db", cliDBPath)
newCliPath := fmt.Sprintf("%s/ente-cli.db", cliDBPath)
if _, err := os.Stat(oldCliPath); err == nil {
log.Printf("migrating old cli db from %s to %s\n", oldCliPath, newCliPath)
if err := os.Rename(oldCliPath, newCliPath); err != nil {
log.Fatalf("Could not rename old cli db\n%v\n", err)
}
}
db, err := pkg.GetDB(newCliPath)
if secrets.IsRunningInContainer() {
cliDBPath = constants.CliDataPath
_, err := internal.ValidateDirForWrite(cliDBPath)