Skip to content

Commit

Permalink
fix: sqlite dsn not valid on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikKalkoken committed Jan 22, 2025
1 parent 73506a9 commit a36b26f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func main() {
log.Fatal(err)
}
logger = &lumberjack.Logger{
Filename: fmt.Sprintf("%s/%s", logDir, logFileName),
Filename: filepath.Join(logDir, logFileName),
MaxSize: logMaxSizeMB,
MaxBackups: logMaxBackups,
}
Expand Down Expand Up @@ -148,14 +148,15 @@ func main() {
// init database
var dbPath string
if isDesktop {
dbPath = fmt.Sprintf("%s/%s", dataDir, dbFileName)
dbPath = filepath.Join(dataDir, dbFileName)
} else {
// EXPERIMENTAL
dbPath = ensureFileExists(fyneApp.Storage(), dbFileName)
}
db, err := storage.InitDB("file://" + dbPath)
dsn := "file:///" + filepath.ToSlash(dbPath)
db, err := storage.InitDB(dsn)
if err != nil {
slog.Error("Failed to initialize database", "dsn", dbPath, "error", err)
slog.Error("Failed to initialize database", "dsn", dsn, "error", err)
os.Exit(1)
}
defer db.Close()
Expand Down

0 comments on commit a36b26f

Please sign in to comment.