Skip to content

Commit fdb8a5c

Browse files
committed
if neovide/mobdap/bridge dont exist always re-download
1 parent eb074f7 commit fdb8a5c

3 files changed

Lines changed: 32 additions & 16 deletions

File tree

crates/core/src/bridge.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ fn version() -> Result<String> {
8686
}
8787

8888
fn is_update_available() -> Result<bool> {
89+
if !local_path()?.exists() {
90+
return Ok(true);
91+
}
92+
8993
if !version_path()?.exists() {
9094
return Ok(true);
9195
}

crates/core/src/mobdap.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,29 @@ fn version() -> Result<String> {
6666
}
6767

6868
pub fn is_update_available() -> Result<bool> {
69-
if version_path()?.exists() {
70-
// if the version file is younger than a week dont bother
71-
let last_modified = version_path()?.metadata()?.modified()?;
72-
if last_modified.elapsed()? < Duration::from_hours(24 * 7) {
73-
return Ok(false);
74-
}
69+
if !path()?.exists() {
70+
return Ok(true);
71+
}
72+
73+
if !version_path()?.exists() {
74+
return Ok(true);
7575
}
7676

7777
let Ok(v) = version() else {
7878
return Ok(true);
7979
};
8080

81+
tracing::debug!("Mobdap Version {v} installed");
82+
83+
// if the version file is younger than a week dont bother
84+
let last_modified = version_path()?.metadata()?.modified()?;
85+
if last_modified.elapsed()? < Duration::from_hours(24 * 7) {
86+
return Ok(false);
87+
}
88+
8189
// re-write the file again so that we only check once a week
8290
fs::write(version_path()?, &v)?;
8391

84-
tracing::debug!("Mobdap Version {v} installed");
85-
8692
let Some(installed) = Version::from(&v) else {
8793
return Ok(true);
8894
};

crates/core/src/neovide.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,29 @@ fn version() -> Result<String> {
6464
}
6565

6666
pub fn is_update_available() -> Result<bool> {
67-
if version_path()?.exists() {
68-
// if the version file is younger than a week dont bother
69-
let last_modified = version_path()?.metadata()?.modified()?;
70-
if last_modified.elapsed()? < Duration::from_hours(24 * 7) {
71-
return Ok(false);
72-
}
67+
if !path()?.exists() {
68+
return Ok(true);
69+
}
70+
71+
if !version_path()?.exists() {
72+
return Ok(true);
7373
}
7474

7575
let Ok(v) = version() else {
7676
return Ok(true);
7777
};
7878

79+
tracing::debug!("Neovide Version {v} installed");
80+
81+
// if the version file is younger than a week dont bother
82+
let last_modified = version_path()?.metadata()?.modified()?;
83+
if last_modified.elapsed()? < Duration::from_hours(24 * 7) {
84+
return Ok(false);
85+
}
86+
7987
// re-write the file again so that we only check once a week
8088
fs::write(version_path()?, &v)?;
8189

82-
tracing::debug!("Neovide Version {v} installed");
83-
8490
let Some(installed) = Version::from(&v) else {
8591
return Ok(true);
8692
};

0 commit comments

Comments
 (0)