package cmd import ( "errors" "isthisnagee.com/tools/diary/model" "log" "os" "path" ) var App *model.App func InitApp() { home_dir, err := os.UserHomeDir() if err != nil { log.Fatal(err.Error()) } var db_path = path.Join(home_dir, ".diary.sql") if _, err := os.Stat(db_path); errors.Is(err, os.ErrNotExist) { _, err := os.Create(db_path) if err != nil { log.Fatal(err.Error()) } } if err != nil { log.Fatal(err.Error()) } var app = model.NewApp(db_path) App = &app }