Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create swarm subdirectories as necessary #943

Merged
merged 2 commits into from
Jan 8, 2023
Merged

Create swarm subdirectories as necessary #943

merged 2 commits into from
Jan 8, 2023

Conversation

xsebek
Copy link
Member

@xsebek xsebek commented Jan 1, 2023

@xsebek xsebek requested a review from kostmo January 1, 2023 17:19
@@ -259,7 +259,7 @@ getDataFileNameSafe name = do

dataNotFound :: FilePath -> IO Text
dataNotFound f = do
d <- getSwarmDataPath False
d <- getSwarmDataPath False ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take it that the empty string represents "no subdirectory", i.e. the "current directory"? Perhaps a Maybe would convey the intentions better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's how path works - a//./ is the same as a.

A good solution might be to use a different function or make a proper ADT type for our sources. 🤔

We should refactor this code and document it better, but let’s do that in a new PR.

@byorgey
Copy link
Member

byorgey commented Jan 7, 2023

@xsebek what's the status of this? Were you going to do more testing or can it be merged?

@xsebek
Copy link
Member Author

xsebek commented Jan 8, 2023

@byorgey it definitely needs to be tested, because it is wrong! 😅

swarm: /root/.local/share/swarm/history: openFile: inappropriate type (Is a directory)
swarm: YamlException "could not open file for write: /root/.local/share/swarm/achievements"

@xsebek
Copy link
Member Author

xsebek commented Jan 8, 2023

Now it works in a fresh ubuntu:bionic container:
image

root@swarm-run:/# tree -L 2 ~/.local/share/swarm
/root/.local/share/swarm
|-- achievements
|-- data
|   |-- about.txt
|   |-- adjectives.txt
|   |-- entities.yaml
|   |-- logo.txt
|   |-- names.txt
|   |-- recipes.yaml
|   |-- scenarios
|   `-- schema
|-- history
`-- saves
    |-- Tutorials_backstory.yaml
    `-- Tutorials_move.yaml

4 directories, 10 files

@xsebek xsebek added the merge me Trigger the merge process of the Pull request. label Jan 8, 2023
@mergify mergify bot merged commit e19674e into main Jan 8, 2023
@mergify mergify bot deleted the create-subdir branch January 8, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash after completing the first step of the tutorial
3 participants