Strophox / tetrs

Tetromino Game Engine + Terminal Application in Rust
MIT License
99 stars 4 forks source link

Not ideal configuration file location #2

Open webgtx opened 3 months ago

webgtx commented 3 months ago

After chaging keybindings in settings, I noticed the json file tetrs_terminal.json in my $HOME directory. Why not move it to $HOME/.config or at least hide it with a dot?

Strophox commented 3 months ago

Hello! I will look into doing what you described (i.e. both using .tetrs_terminal.json to hide the file and attempting to store it in the OS' appropriate location for app data/configurations).

webgtx commented 3 months ago

Consider swapping json with yaml as well. I'd prefer it because it's easier to read or edit.

Strophox commented 3 months ago

Hi again! I've been unhappy with how it always automatically saved for a while so now there's even a manual toggle to Keep savefile for tetrs now.

Concerning location I added some compile flags that will automatically determine a good location for the savefile e.g. ~/.config/ for Linux (if available, otherwise ./.tetrs_terminal.json.

I will keep it as a .json for now as it's decent and simple enough, and I don't expect a user to have to manually edit it a lot in the first place.

Let me know if this suits your needs!

webgtx commented 2 months ago

Hey @Strophox, thanks for the update. Can you tell me what these flags are? I have tried to build tetris with cargo build, but saving files doesn't work. I even checked the Keep save file for tetris option.

Strophox commented 2 months ago

The newest commit makes it so the savefile path is shown on the Settings screen.

The OS flags (cfg!(target_os =.."windows"/"linux"/"macos") are in the code here: https://github.com/Strophox/tetrs/blob/141ad0253768c4980d7d5f03af475f8e71866793/tetrs_terminal/src/terminal_tetrs.rs#L245-L274

At present, if saving to the chosen location fails, it is not further handled, and I should fix that sometime :)