diff --git a/examples/provider-sync.rs b/examples/provider-sync.rs index 5b73f10..4e6cd3c 100644 --- a/examples/provider-sync.rs +++ b/examples/provider-sync.rs @@ -17,6 +17,8 @@ mod shared; use shared::initial_sync; use shared::{URL, USERNAME, EXAMPLE_EXISTING_CALENDAR_URL, EXAMPLE_CREATED_CALENDAR_URL}; +const CACHE_FOLDER: &str = "test_cache/provider_sync"; + #[tokio::main] async fn main() { @@ -33,7 +35,7 @@ async fn main() { println!(" * EXAMPLE_CREATED_CALENDAR_URL = {}", EXAMPLE_CREATED_CALENDAR_URL); pause(); - let mut provider = initial_sync().await; + let mut provider = initial_sync(CACHE_FOLDER).await; add_items_and_sync_again(&mut provider).await; } diff --git a/examples/shared.rs b/examples/shared.rs index e158f34..3cb7f2e 100644 --- a/examples/shared.rs +++ b/examples/shared.rs @@ -14,16 +14,14 @@ pub const PASSWORD: &str = "secret_password"; pub const EXAMPLE_EXISTING_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_name/"; pub const EXAMPLE_CREATED_CALENDAR_URL: &str = "https://my.server.com/remote.php/dav/calendars/john/a_calendar_that_we_have_created/"; -const CACHE_FOLDER: &str = "test_cache/provider_sync"; - fn main() { panic!("This file is not supposed to be executed"); } /// Initializes a Provider, and run an initial sync from the server -pub async fn initial_sync() -> CalDavProvider { - let cache_path = Path::new(CACHE_FOLDER); +pub async fn initial_sync(cache_folder: &str) -> CalDavProvider { + let cache_path = Path::new(cache_folder); let client = Client::new(URL, USERNAME, PASSWORD).unwrap(); let cache = match Cache::from_folder(&cache_path) { diff --git a/examples/toggle-completions.rs b/examples/toggle-completions.rs index 47fa3b7..592f608 100644 --- a/examples/toggle-completions.rs +++ b/examples/toggle-completions.rs @@ -14,6 +14,7 @@ mod shared; use shared::initial_sync; use shared::{URL, USERNAME}; +const CACHE_FOLDER: &str = "test_cache/toggle_completion"; #[tokio::main] async fn main() { @@ -28,7 +29,7 @@ async fn main() { println!(" * USERNAME = {}", USERNAME); pause(); - let mut provider = initial_sync().await; + let mut provider = initial_sync(CACHE_FOLDER).await; toggle_all_tasks_and_sync_again(&mut provider).await.unwrap(); }