Skip to content

Commit

Permalink
Add updates storage paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaz492 committed Nov 10, 2024
1 parent 87d3580 commit c25cd47
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
17 changes: 15 additions & 2 deletions dbg/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,20 @@ func getAppVersion() (AppMeta, error) {
}

func getProfiles() (Profiles, error) {
profilesPath := filepath.Join(ftbApp.InstallLocation, "profiles.json")
oldProfilesPath := filepath.Join(ftbApp.InstallLocation, "profiles.json")
oldProfilesExists := shared.DoesPathExist(oldProfilesPath)
if oldProfilesExists {
profilesRaw, err := os.ReadFile(oldProfilesPath)
if err != nil {
return Profiles{}, err
}
var profiles Profiles
if err := json.Unmarshal(profilesRaw, &profiles); err != nil {
return Profiles{}, err
}
return profiles, nil
}
profilesPath := filepath.Join(ftbApp.InstallLocation, "storage", "mc-accounts.json")
profilesExists := shared.DoesPathExist(profilesPath)
if profilesExists {
profilesRaw, err := os.ReadFile(profilesPath)
Expand All @@ -222,7 +235,7 @@ func getProfiles() (Profiles, error) {
}
return profiles, nil
}
return Profiles{}, errors.New("profiles.json not found")
return Profiles{}, errors.New("profiles/mc-accounts.json not found")
}

func getAppLogs() (map[string]string, error) {
Expand Down
10 changes: 7 additions & 3 deletions dbg/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,13 @@ type (
Profiles struct {
Version string `json:"version"`
Profiles []struct {
UUID string `json:"uuid"`
LastLogin int `json:"lastLogin"`
Username string `json:"username"`
UUID string `json:"uuid"`
LastLogin int `json:"lastLogin,omitempty"`
Username string `json:"username,omitempty"`
MinecraftUsername string `json:"minecraftUsername,omitempty"`
MinecraftAccessTokenExpiresAt int `json:"minecraftAccessExpiresAt,omitempty"`
MicrosoftAccessTokenExpiresAt int `json:"microsoftAccessExpiresAt,omitempty"`
NotLoggedIn bool `json:"notLoggedIn,omitempty"`
} `json:"profiles"`
ActiveProfile string `json:"activeProfile"`
}
Expand Down

0 comments on commit c25cd47

Please sign in to comment.