Skip to content

Commit

Permalink
Store jars in user specific directory (#137)
Browse files Browse the repository at this point in the history
* use user specific directory

* update changelog
  • Loading branch information
rnbguy authored Dec 2, 2021
1 parent b5a82cd commit 92c9faa
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/unreleased/notes/rust/137-jar-dir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A unique directory to store model-checker jars.
31 changes: 31 additions & 0 deletions rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rs/modelator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ authors = [

[dependencies]
clap = "=3.0.0-beta.5"
directories = "4.0.1"
hex = "0.4.3"
lazy_static = "1.4.0"
nom = "7.1.0"
Expand Down
5 changes: 4 additions & 1 deletion rs/modelator/src/jar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ pub(crate) fn download_jars_if_necessary<P: AsRef<Path>>(modelator_dir: P) -> Re

if !missing_jars.is_empty() {
// download missing jars
println!("[modelator] Downloading model-checkers... ");
println!(
"[modelator] Downloading model-checkers at \"{}\"...",
modelator_dir.as_ref().to_string_lossy()
);
for jar in missing_jars {
jar.download(&modelator_dir)?;
}
Expand Down
5 changes: 4 additions & 1 deletion rs/modelator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ impl Default for ModelatorRuntime {
fn default() -> Self {
Self {
model_checker_runtime: ModelCheckerRuntime::default(),
dir: env::current_dir().unwrap().join(".modelator"), //Path::new(".modelator").to_path_buf(),
dir: directories::ProjectDirs::from("systems", "Informal", "modelator")
.expect("there is no valid home directory")
.data_dir()
.into(), // env::home_dir().unwrap().join(".modelator"), //Path::new(".modelator").to_path_buf(),
}
}
}
Expand Down

0 comments on commit 92c9faa

Please sign in to comment.