Skip to content

Commit

Permalink
[middle] Fix data path not creating on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
lexisother committed Jul 31, 2023
1 parent 0b46f5f commit d30abe3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions middle/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,21 @@ func GetUserData() *UserData {

// GetDataPath returns the path to the installer's data path.
func GetDataPath() string {
dirs := appdir.New("replugged-installer")
data := dirs.UserData()

// We LOVE platform-specific hacks.
// Fixes the running-as-root $HOME issue.
if IsLinux() {
userData := GetUserData()
if userData.Name != "" {
usr := strings.TrimSuffix(userData.Name, "\n")
return fmt.Sprintf("/home/%s/.local/share/replugged-installer", usr)
data = fmt.Sprintf("/home/%s/.local/share/replugged-installer", usr)
} else {
return ""
}
}

dirs := appdir.New("replugged-installer")
data := dirs.UserData()

if err := os.MkdirAll(data, 0755); err != nil {
panic(err)
}
Expand Down

0 comments on commit d30abe3

Please sign in to comment.