feat: add os module

This commit is contained in:
Jonas Kruckenberg 2022-11-15 16:28:34 +01:00
parent 45bd3650ea
commit 822910bb38
7 changed files with 164 additions and 3 deletions

View file

@ -3,6 +3,7 @@ mod clipboard;
mod event;
mod window;
mod dialog;
mod os;
extern crate console_error_panic_hook;
use std::future::Future;
@ -153,6 +154,11 @@ fn main() {
InteractiveTest(name="dialog::pick_folder",test=dialog::pick_folder())
InteractiveTest(name="dialog::pick_folders",test=dialog::pick_folders())
InteractiveTest(name="dialog::save",test=dialog::save())
Test(name="os::arch",test=os::arch())
Test(name="os::platform",test=os::platform())
Test(name="os::tempdir",test=os::tempdir())
Test(name="os::kind",test=os::kind())
Test(name="os::version",test=os::version())
// Test(name="window::WebviewWindow::new",test=window::create_window())

41
examples/test/src/os.rs Normal file
View file

@ -0,0 +1,41 @@
use tauri_sys::os;
pub async fn arch() -> anyhow::Result<()> {
let arch = os::arch().await?;
log::debug!("{:?}", arch);
Ok(())
}
pub async fn platform() -> anyhow::Result<()> {
let platform = os::platform().await?;
log::debug!("{:?}", platform);
Ok(())
}
pub async fn tempdir() -> anyhow::Result<()> {
let tempdir = os::tempdir().await?;
log::debug!("{:?}", tempdir);
Ok(())
}
pub async fn kind() -> anyhow::Result<()> {
let kind = os::kind().await?;
log::debug!("{:?}", kind);
Ok(())
}
pub async fn version() -> anyhow::Result<()> {
let version = os::version().await?;
log::debug!("{:?}", version);
Ok(())
}