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

fix(paths): add os specific directory handling for windows #38

Merged
merged 1 commit into from
Oct 22, 2023

Conversation

0Ky
Copy link
Contributor

@0Ky 0Ky commented Oct 20, 2023

Adjusted the path generation in get_results_dir_path, handle_main_command, and setup_terminal functions to account for Windows-specific local config directory conventions using the cfg! macro.

This PR closes issue #37.

Below are paths for both the config & results files by OS.

Config file:

Windows: C:\Users\{Username}\AppData\Local\donkeytype\donkeytype-config.json
Linux: /home/{Username}/.config/donkeytype/donkeytype-config.json
MacOS: /Users/{Username}/.config/donkeytype/donkeytype-config.json

Results file:

Windows: C:\Users\{Username}\AppData\Local\donkeytype\donkeytype-results.csv
Linux: /home/{Username}/.local/share/donkeytype/donkeytype-results.csv
MacOS: /Users/{Username}/.local/share/donkeytype/donkeytype-results.csv

Adjusted the path generation in `get_results_dir_path`, `handle_main_command`, and `setup_terminal` to account for Windows-specific local config directory conventions using the `cfg!` macro.
Copy link
Owner

@radlinskii radlinskii left a comment

Choose a reason for hiding this comment

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

Looks really clean 👏 Did you test it on Windows?

@0Ky
Copy link
Contributor Author

0Ky commented Oct 21, 2023

Looks really clean 👏 Did you test it on Windows?

Running cargo test passes.

test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s

I've also conducted tests manually on Windows OS, the donkeytype-results.csv file is generated at the expected path after completing a type test and adding donkeytype-config.json file to the same path with custom configuration is interpreted correctly.

@radlinskii radlinskii merged commit 33a3b08 into radlinskii:main Oct 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants