diff options
| author | YummyOreo <bobgim20@gmail.com> | 2023-03-05 13:00:59 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-05 19:00:59 +0000 |
| commit | e9c5e1d85c5c1d3310fb7994c474f9462c0bca97 (patch) | |
| tree | 22ca21bc9f8a6b6fb860acc89ae69008df90e262 /atuin-common | |
| parent | Bump debian from bullseye-20230208-slim to bullseye-20230227-slim (#744) (diff) | |
| download | atuin-e9c5e1d85c5c1d3310fb7994c474f9462c0bca97.zip | |
Windows support (#754)
* adds support for getting home dir in windows
* fixes bug
* adds windows server support + build for linux ^| todo: test server on linux
* improvements to redability
* removes comment
* returns if windows when importing auto
* this should be here, to prevent double inputs
* adds explanation to why we have to throw away 1 event in the tui
* better message when running atuin import on windows + spell fix
Diffstat (limited to 'atuin-common')
| -rw-r--r-- | atuin-common/src/utils.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/atuin-common/src/utils.rs b/atuin-common/src/utils.rs index a73e3fba..d85b3b96 100644 --- a/atuin-common/src/utils.rs +++ b/atuin-common/src/utils.rs @@ -10,11 +10,19 @@ pub fn uuid_v4() -> String { // TODO: more reliable, more tested // I don't want to use ProjectDirs, it puts config in awkward places on // mac. Data too. Seems to be more intended for GUI apps. + +#[cfg(not(target_os = "windows"))] pub fn home_dir() -> PathBuf { let home = std::env::var("HOME").expect("$HOME not found"); PathBuf::from(home) } +#[cfg(target_os = "windows")] +pub fn home_dir() -> PathBuf { + let home = std::env::var("USERPROFILE").expect("%userprofile% not found"); + PathBuf::from(home) +} + pub fn config_dir() -> PathBuf { let config_dir = std::env::var("XDG_CONFIG_HOME").map_or_else(|_| home_dir().join(".config"), PathBuf::from); |
