Use WriteFile instead of stream writing to files

This commit is contained in:
maru committed 2024-04-22 18:01:17 -04:00
1 parent 8f51cd826c
commit b00ed4c0b9
2 files changed
+27 -28

No files matched your search

+6
View File
@@ -3,6 +3,7 @@ package account
import (
"crypto/rand"
"fmt"
"os"
"github.com/pagefaultgames/pokerogue-server/db"
)
@@ -34,5 +35,10 @@ func Register(username, password string) error {
return fmt.Errorf("failed to add account record: %s", err)
}
err = os.MkdirAll(fmt.Sprintf("userdata/%x", uuid), 0755)
if err != nil && !os.IsExist(err) {
return fmt.Errorf(fmt.Sprintf("failed to create userdata folder: %s", err))
}
return nil
}