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

Disable model version check on Windows #1308

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
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
53 changes: 30 additions & 23 deletions crates/fj-host/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,32 +105,39 @@ impl Model {
let lib = libloading::Library::new(&self.lib_path)
.map_err(Error::LoadingLibrary)?;

let version_pkg: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?;

let version_pkg = version_pkg().to_string();
if fj::version::VERSION_PKG != version_pkg {
let host = String::from_utf8_lossy(
fj::version::VERSION_PKG.as_bytes(),
)
.into_owned();
let model = version_pkg;

return Err(Error::VersionMismatch { host, model });
}
if cfg!(target_os = "windows") {
warn!(
"Version check is disabled on Windows (see \
https://github.com/hannobraun/Fornjot/issues/1307)"
);
} else {
let version_pkg: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_pkg").map_err(Error::LoadingVersion)?;

let version_pkg = version_pkg().to_string();
if fj::version::VERSION_PKG != version_pkg {
let host = String::from_utf8_lossy(
fj::version::VERSION_PKG.as_bytes(),
)
.into_owned();
let model = version_pkg;

return Err(Error::VersionMismatch { host, model });
}

let version_full: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_full").map_err(Error::LoadingVersion)?;
let version_full: libloading::Symbol<fn() -> RawVersion> =
lib.get(b"version_full").map_err(Error::LoadingVersion)?;

let version_full = version_full().to_string();
if fj::version::VERSION_FULL != version_full {
let host = String::from_utf8_lossy(
fj::version::VERSION_FULL.as_bytes(),
)
.into_owned();
let model = version_full;
let version_full = version_full().to_string();
if fj::version::VERSION_FULL != version_full {
let host = String::from_utf8_lossy(
fj::version::VERSION_FULL.as_bytes(),
)
.into_owned();
let model = version_full;

warn!("{}", Error::VersionMismatch { host, model });
warn!("{}", Error::VersionMismatch { host, model });
}
}

let init: libloading::Symbol<abi::InitFunction> = lib
Expand Down
2 changes: 1 addition & 1 deletion crates/fj-host/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl Platform for Unix {
}
}

// Represents common apis availiable independent of hosts
// Abstracts over differences in host platforms
pub struct HostPlatform;

impl HostPlatform {
Expand Down