Skip to content

Commit

Permalink
Add some messages & pausing on screens
Browse files Browse the repository at this point in the history
  • Loading branch information
g026r committed Sep 15, 2024
1 parent 80c00d6 commit 66d9f21
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 75 deletions.
18 changes: 11 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io/fs"
"log"
"os"
"path/filepath"
"slices"
Expand All @@ -25,7 +24,7 @@ func main() {
switch len(os.Args) {
case 1:
if arg, err = os.Executable(); err != nil { // TODO: Would it be better to use cwd instead?
log.Fatal(err)
fatal(err)
}
case 2:
arg = os.Args[1]
Expand All @@ -36,26 +35,31 @@ func main() {

app, err := loadPocketDir(arg)
if err != nil {
log.Fatal(err)
fatal(err)
}

if c, err := util.LoadConfig(); err == nil {
if c, err := model.LoadConfig(); err == nil {
app.Config = c
}

if app.ShowAdd { // Only need to load these for the add UI
library, err := loadInternal()
if err != nil {
log.Fatal(err)
fatal(err)
}
app.Internal = library
}

if err := app.Run(); err != nil {
log.Fatal(err)
fatal(err)
}
}

func fatal(err error) {
fmt.Printf("\nFATAL ERROR: %v\n", err)
os.Exit(1)
}

func printUsage() {
fmt.Println("Usage: place in the root of your Pocket's SD card & run. Or run & pass it the path to the SD card root as an argument.")
fmt.Println("Outputs files in the current working directory.")
Expand Down Expand Up @@ -106,7 +110,7 @@ func loadPocketDir(d string) (pkg.Application, error) {
Entries: entries,
PlayTimes: playtimes,
Thumbs: thumbs,
Config: util.Config{
Config: model.Config{
RemoveImages: true,
AdvancedEditing: false,
ShowAdd: true,
Expand Down
Loading

0 comments on commit 66d9f21

Please sign in to comment.