Skip to content

Commit

Permalink
fix: delete .worldcli cache file if it exists before creating .worldc…
Browse files Browse the repository at this point in the history
…li directory (#54)

Closes: WORLD-1020

## Overview
Previously the `.worldcli` file was used as a cache for the last logged
in time for posthog. This file was moved to
`.worldcli/last_logged_time`, so the setup function should remove it
before creating the `.worldcli` directory.

## Brief Changelog
- delete .worldcli cache file if it exists before creating .worldcli
directory

## Testing and Verifying
Manually tested & verified

Co-authored-by: Ryan Martin <[email protected]>
  • Loading branch information
rmrt1n and rmrt1n authored Apr 1, 2024
1 parent 9c1d1ca commit 3d39862
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ dist/

# Test
/starter-game

# Built binary
world
11 changes: 11 additions & 0 deletions common/globalconfig/globalconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,16 @@ func SetupConfigDir() error {
return err
}

fs, err := os.Stat(fullConfigDir)
if !os.IsNotExist(err) {
// remove old .worldcli file
if !fs.IsDir() {
err = os.Remove(fullConfigDir)
if err != nil {
return err
}
}
}

return os.MkdirAll(fullConfigDir, 0755)
}
Binary file removed world
Binary file not shown.

0 comments on commit 3d39862

Please sign in to comment.