feat: loader logic
This commit is contained in:
+11
-4
@@ -163,10 +163,10 @@ func (s *fsStorage) SaveOrderAsync(id client.GameID, turn uint, o order.Order, c
|
||||
}()
|
||||
}
|
||||
|
||||
func (s *fsStorage) FileExists(path string) (bool, error) {
|
||||
func (s *fsStorage) FileExists(path string) (bool, string, error) {
|
||||
absPath, err := s.resolvePath(path)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return false, "", err
|
||||
}
|
||||
|
||||
var exists bool
|
||||
@@ -175,7 +175,13 @@ func (s *fsStorage) FileExists(path string) (bool, error) {
|
||||
exists, opErr = s.fileExistsUnlocked(absPath)
|
||||
return opErr
|
||||
})
|
||||
return exists, err
|
||||
if err != nil {
|
||||
return false, "", err
|
||||
}
|
||||
if !exists {
|
||||
return false, "", nil
|
||||
}
|
||||
return true, absPath, nil
|
||||
}
|
||||
|
||||
func (s *fsStorage) ReadFile(path string) ([]byte, error) {
|
||||
@@ -254,7 +260,8 @@ func (s *fsStorage) ListFiles() ([]string, error) {
|
||||
}
|
||||
|
||||
func (s *fsStorage) StateExists() (bool, error) {
|
||||
return s.FileExists(stateFileName)
|
||||
exists, _, err := s.FileExists(stateFileName)
|
||||
return exists, err
|
||||
}
|
||||
|
||||
func (s *fsStorage) LoadState() (client.State, error) {
|
||||
|
||||
Reference in New Issue
Block a user