-
Notifications
You must be signed in to change notification settings - Fork 317
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
Centralised place to store all data #38
Comments
Sounds like a great idea. But what about Windows? |
Yes I thought about that, I guess in windows we run this game on git-bash, I saw there was a directory /usr/lib/ and we can access this dir with git-bash , so it will be cross platform. |
I'll try to implement this and test it both on Windows and linux, and with this I also want to properly deploy the binary and able to play the game from anywhere just like a command. |
This will be great! Waiting on it :) |
We can use code for checking the operating system and if it find windows then the files can be saved in the windows user/documents directly or if it finds linux then /use/lib/2048. |
@farazxameer, @VishwasT has made a good point |
@farazxameer Any progress? 😄 |
I think it would be better to use |
Instead of checking the operating system and write a lot of code to do so, use conditional compiling. After all, where data will be stored is dependent on the operating system. So, it makes little sense make system calls to evaluate what is the operating system in order to decide where to save stuff. The best approach is to save data into user's home folder. For *nix operating systems you can do it on a single file on $HOME in a name like .2048. If you need several files, it can be a directory. For Windows users, it should be a file or directory under user's home directory. There is a special directory only for that. The best is to encapsulate the way user's home directory is determined and let the implementation do the job. So, you can conditionally compile the implementation, letting the interface independent. |
Hey @ronflima! Thanks a lot for your inputs, your way certainly seems like the neatest and most correct way to do so. If you have time in your hands, please consider proposing a PR to implement the same. Thanks again 😄! |
Hi, I got busy with my exam, it will be really good if anybody wants to implement this functionality. |
No problem! You can try implementing it, I don't think anyone has taken it up right now 😄 |
Hey! Can I try writing creating a PR if nobody is working on it already? I'm comfortable with C++ but this would be my first PR ever |
We should be storing the game data in some centralised folder like
/usr/lib/2048/
.The text was updated successfully, but these errors were encountered: