Use WriteFile instead of stream writing to files
This commit is contained in:
2 files changed
+27
-28
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user