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

[bug] plugin/os can't get current system info correctly! #2170

Open
barbyJam opened this issue Dec 9, 2024 · 2 comments
Open

[bug] plugin/os can't get current system info correctly! #2170

barbyJam opened this issue Dec 9, 2024 · 2 comments
Labels
enhancement New feature or request plugin: os

Comments

@barbyJam
Copy link

barbyJam commented Dec 9, 2024

Describe the bug

When I was using the tauri-plugin/os v2.0.1 in the Release condition, such as: arch() method, the app can't get the correctly sys. architection. However, in the development condition, it can be obtained correctly.

Reproduction

There are some tests with my computer, and output result:

  • development & building: Windows 11 x64
  • executing method: arch()
  1. not set any argument, development mode, printing: x86_x64

  2. build with i686 msvc(release mode), testing:

  • run in the Windows 10/11 x64: x86
  • run in the Windows 10/11 x86: x86
  1. build with x64 msvc(release mode), testing:
  • run in the Windows 10/11 x64: x86_64
  • run in the Windows 10/11 x86: it not need to test.
  1. Conclusion
  • From my perspective, the result should be printed the diversity value in the different systems, but it output same results.

  • Given the results provided, which more depend my compiling environment's ARCH. that Rust building rather than the real system environment that user run?

Expected behavior

Outputing correctly system ARCH.

Stack trace

No response

Additional context

No response

@barbyJam barbyJam changed the title [bug] plugin/os can't get current system correctly! [bug] plugin/os can't get current system info correctly! Dec 9, 2024
@FabianLars
Copy link
Member

Given the results provided, which more depend my compiling environment's ARCH. that Rust building rather than the real system environment that user run?

That's exactly what's happening. The plugin's arch() function simply exposes https://doc.rust-lang.org/std/env/consts/constant.ARCH.html which is defined at compile time.

@FabianLars FabianLars transferred this issue from tauri-apps/tauri Dec 9, 2024
@FabianLars FabianLars added enhancement New feature or request plugin: os labels Dec 9, 2024
@barbyJam
Copy link
Author

barbyJam commented Dec 9, 2024

Strangely, the version() Func. do get the realtime Sys. version ...

Now, I review those code below as: "\tauri-plugin-os-2.0.1\src\lib.rs"

line 53~56

pub fn version() -> Version {
    os_info::get().version().clone()
}

and line 84~86

pub fn arch() -> &'static str {
    std::env::consts::ARCH
}

May the get() method is a property rather than static const.

Aha... Navigating the reference, I can see the crate's code: "\os_info-3.9.0\src\windows\mod.rs"

//method with public using
pub fn get() -> Info {
    imp::current_platform()
}

//deeply the implement
pub fn current_platform() -> Info {
    trace!("windows::current_platform is called");
    let info = winapi::get();
    trace!("Returning {:?}", info);
    info
}

So, winapi should be a realtime Lib.

Okay, I think that if you can use the winapi of the other sub method, we may get the realtime of the Sys. Arch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request plugin: os
Projects
None yet
Development

No branches or pull requests

2 participants