mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-10 21:27:21 +00:00
Took the architecture from the build target instead of metadata.txt (#1070)
This commit is contained in:
1 parent
db2cbaa71e
commit
940d214429
11 files changed
+37
-155
No files matched your search
@@ -38,12 +38,12 @@ impl MetaData {
|
||||
let mud_blazor_version = metadata_lines.next().unwrap();
|
||||
let tauri_version = metadata_lines.next().unwrap();
|
||||
let app_commit_hash = metadata_lines.next().unwrap();
|
||||
let architecture = metadata_lines.next().unwrap();
|
||||
let pdfium_version = metadata_lines.next().unwrap();
|
||||
let vector_store_version = metadata_lines.next().unwrap();
|
||||
|
||||
let metadata = MetaData {
|
||||
architecture: architecture.to_string(),
|
||||
// The build script names the platform the runtime is built for:
|
||||
architecture: env!("AI_STUDIO_ARCHITECTURE").to_string(),
|
||||
app_commit_hash: app_commit_hash.to_string(),
|
||||
app_version: app_version.to_string(),
|
||||
build_number: build_number.to_string(),
|
||||
|
||||
+1
-43
@@ -6,10 +6,7 @@ use std::sync::OnceLock;
|
||||
use log::{info, warn};
|
||||
use tokio::process::Command;
|
||||
use crate::environment::{DATA_DIRECTORY, is_flatpak};
|
||||
use crate::metadata::META_DATA;
|
||||
|
||||
/// Tracks whether the RID mismatch warning has been logged.
|
||||
static HAS_LOGGED_RID_MISMATCH: OnceLock<()> = OnceLock::new();
|
||||
static HAS_LOGGED_PANDOC_PATH: OnceLock<()> = OnceLock::new();
|
||||
const FLATPAK_PANDOC_PLUGIN_BIN_DIRECTORY: &str = "/app/plugins/pandoc/bin";
|
||||
|
||||
@@ -243,47 +240,8 @@ impl PandocProcessBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
/// Determines the executable name based on the current OS at runtime.
|
||||
///
|
||||
/// This uses runtime detection instead of metadata to ensure correct behavior
|
||||
/// on dev machines where the metadata may contain stale values.
|
||||
/// Determines the executable name based on the OS the runtime is built for.
|
||||
fn pandoc_executable_name() -> String {
|
||||
// Log a warning (once) if the runtime OS differs from the metadata architecture.
|
||||
// This can happen on dev machines where the metadata.txt contains stale values.
|
||||
HAS_LOGGED_RID_MISMATCH.get_or_init(|| {
|
||||
let runtime_os = std::env::consts::OS;
|
||||
let runtime_arch = std::env::consts::ARCH;
|
||||
|
||||
if let Ok(metadata) = META_DATA.lock() && let Some(metadata) = metadata.as_ref() {
|
||||
let metadata_arch = &metadata.architecture;
|
||||
|
||||
// Determine expected OS from metadata:
|
||||
let metadata_is_windows = metadata_arch.starts_with("win-");
|
||||
let metadata_is_macos = metadata_arch.starts_with("osx-");
|
||||
let metadata_is_linux = metadata_arch.starts_with("linux-");
|
||||
|
||||
// Compare with runtime OS:
|
||||
let runtime_is_windows = runtime_os == "windows";
|
||||
let runtime_is_macos = runtime_os == "macos";
|
||||
let runtime_is_linux = runtime_os == "linux";
|
||||
|
||||
let os_mismatch = (metadata_is_windows != runtime_is_windows)
|
||||
|| (metadata_is_macos != runtime_is_macos)
|
||||
|| (metadata_is_linux != runtime_is_linux);
|
||||
|
||||
if os_mismatch {
|
||||
warn!(
|
||||
Source = "Pandoc";
|
||||
"Runtime-detected OS '{}-{}' differs from metadata architecture '{}'. Using runtime-detected OS. This is expected on dev machines where metadata.txt may be outdated.",
|
||||
runtime_os,
|
||||
runtime_arch,
|
||||
metadata_arch
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Use std::env::consts::OS for runtime detection instead of metadata
|
||||
match std::env::consts::OS {
|
||||
"windows" => "pandoc.exe".to_string(),
|
||||
_ => "pandoc".to_string(),
|
||||
|
||||
Reference in new issue
Block a user