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

tmp #6

Merged
merged 1 commit into from
May 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/persistent_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ impl PersistentDataStore {
.collect::<Result<Vec<_>, std::io::Error>>()?;

run_dirs.sort_unstable();
run_dirs.pop(); // Don't include the current run.
run_dirs.reverse();

debug!("Found past runs: {:?}", run_dirs);
Ok(run_dirs)
}

Expand All @@ -180,8 +183,11 @@ impl PersistentDataStore {
let dir = run_dirs.get(invocation);
match dir {
Some(dir) => {
debug!("Reading run info from {}", dir.display());
let run_info = std::fs::read_to_string(dir.join("run_info.json"))
.context("couldn't read run info json")?;
let run_info: RunInfo =
serde_json::from_str(&std::fs::read_to_string(dir.join("run_info.json"))?)?;
serde_json::from_str(&run_info).context("couldn't deserialize run info")?;
Ok(run_info)
}
None => {
Expand All @@ -199,7 +205,7 @@ impl PersistentDataStore {
let mut ret = Vec::new();

// Skip the first one as it is the current run.
for dir in run_dirs.into_iter().skip(1) {
for dir in run_dirs.into_iter() {
debug!("Reading run info from {}", dir.display());

let run_info: RunInfo =
Expand Down