-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sync): moved logic in sync-test scripts into rust, enabling sync…
… with a single command (#430) * feat(sync): moved logic in `test-sync-pull/push.sh` scripts into rust code, enabling easy sync with a single command * fix: fixes to sync dirs * fix: moved --sync-dir arg into sync-advanced subcommand, fixed warnings * fix: pass around client instead of port/testing * fix: fixed log dir for aw-sync, misc sync fixes and refactor
- Loading branch information
Showing
13 changed files
with
385 additions
and
110 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use dirs::home_dir; | ||
use std::fs; | ||
use std::path::PathBuf; | ||
|
||
// TODO: This could be refactored to share logic with aw-server/src/dirs.rs | ||
// TODO: add proper config support | ||
#[allow(dead_code)] | ||
pub fn get_config_dir() -> Result<PathBuf, ()> { | ||
let mut dir = appdirs::user_config_dir(Some("activitywatch"), None, false)?; | ||
dir.push("aw-sync"); | ||
fs::create_dir_all(dir.clone()).expect("Unable to create config dir"); | ||
Ok(dir) | ||
} | ||
|
||
pub fn get_server_config_path(testing: bool) -> Result<PathBuf, ()> { | ||
let dir = aw_server::dirs::get_config_dir()?; | ||
Ok(dir.join(if testing { | ||
"config-testing.toml" | ||
} else { | ||
"config.toml" | ||
})) | ||
} | ||
|
||
pub fn get_sync_dir() -> Result<PathBuf, ()> { | ||
// TODO: make this configurable | ||
home_dir().map(|p| p.join("ActivityWatchSync")).ok_or(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.