mirror of
https://github.com/storytold/materialcraft.git
synced 2026-11-30 10:04:02 +01:00
Disk cache recognizes craft-atomic's staging names that keep the file extension; update prompt test reads next's dialog words
This commit is contained in:
1 parent
2afa397987
commit
ffbb1b3c56
2 files changed
+6
-2
No files matched your search
@@ -238,10 +238,13 @@ fn digest_name(stem: &str) -> bool {
|
||||
stem.len() == 64 && stem.bytes().all(|byte| byte.is_ascii_hexdigit())
|
||||
}
|
||||
|
||||
/// craft-atomic's staging file of a cache file: `.{file}.{pid}-{n}.craft_tmp`, where `file` is the cache file's name or
|
||||
/// its first part (older craft-atomic cut it to 64 characters).
|
||||
fn staging_name(name: &str) -> bool {
|
||||
let Some((stem, suffix)) = name.strip_prefix('.').and_then(|name| name.strip_suffix(".craft_tmp")).and_then(|name| name.split_once('.')) else {
|
||||
let Some((file, suffix)) = name.strip_prefix('.').and_then(|name| name.strip_suffix(".craft_tmp")).and_then(|name| name.rsplit_once('.')) else {
|
||||
return false;
|
||||
};
|
||||
let stem = file.split_once('.').map_or(file, |(stem, _)| stem);
|
||||
|
||||
digest_name(stem) && suffix.split_once('-').is_some_and(|(pid, counter)| pid.parse::<u32>().is_ok_and(|pid| pid > 0) && counter.parse::<u64>().is_ok())
|
||||
}
|
||||
|
||||
@@ -178,7 +178,8 @@ fn an_offered_release_opens_the_prompt_over_the_window() {
|
||||
|
||||
harness.run_steps(3);
|
||||
|
||||
let _ = harness.get_by_label("LATER");
|
||||
let _ = harness.get_by_label("Update available");
|
||||
let _ = harness.get_by_label("Later");
|
||||
assert!(harness.state().updates_rt.updater.prompt_open());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user