Skip to content

Commit 29ce9ce

Browse files
refactor(core): move os endpoints to a dedicated plugin (#6902)
Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
1 parent 3245d14 commit 29ce9ce

File tree

9 files changed

+12
-304
lines changed

9 files changed

+12
-304
lines changed

.changes/move-os.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"api": patch
3+
"tauri": patch
4+
---
5+
6+
Moved the `os` feature to its own plugin in the plugins-workspace repository.

core/tauri/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ bytes = { version = "1", features = [ "serde" ] }
6666
raw-window-handle = "0.5"
6767
minisign-verify = { version = "0.2", optional = true }
6868
time = { version = "0.3", features = [ "parsing", "formatting" ], optional = true }
69-
os_info = { version = "3", optional = true }
7069
glob = "0.3"
7170
data-url = { version = "0.2", optional = true }
7271
serialize-to-javascript = "=0.1.1"
@@ -198,7 +197,7 @@ global-shortcut-all = [ ]
198197
http-all = [ "http-request" ]
199198
http-request = [ ]
200199
notification-all = [ ]
201-
os-all = [ "os_info" ]
200+
os-all = [ ]
202201
path-all = [ ]
203202
process-all = [ "process-relaunch", "process-exit" ]
204203
process-exit = [ ]

core/tauri/scripts/bundle.global.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/tauri/src/endpoints.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ use serde_json::Value as JsonValue;
1313
use std::sync::Arc;
1414

1515
mod event;
16-
#[cfg(os_any)]
17-
mod operating_system;
1816
#[cfg(process_any)]
1917
mod process;
2018
mod window;
@@ -55,8 +53,6 @@ impl<T: Serialize> From<T> for InvokeResponse {
5553
enum Module {
5654
#[cfg(process_any)]
5755
Process(process::Cmd),
58-
#[cfg(os_any)]
59-
Os(operating_system::Cmd),
6056
Window(Box<window::Cmd>),
6157
Event(event::Cmd),
6258
}
@@ -82,13 +78,6 @@ impl Module {
8278
.and_then(|r| r.json)
8379
.map_err(InvokeError::from_anyhow)
8480
}),
85-
#[cfg(os_any)]
86-
Self::Os(cmd) => resolver.respond_async(async move {
87-
cmd
88-
.run(context)
89-
.and_then(|r| r.json)
90-
.map_err(InvokeError::from_anyhow)
91-
}),
9281
Self::Window(cmd) => resolver.respond_async(async move {
9382
cmd
9483
.run(context)

core/tauri/src/endpoints/operating_system.rs

Lines changed: 0 additions & 115 deletions
This file was deleted.

examples/api/src/App.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script>
22
import { writable } from 'svelte/store'
33
import { appWindow, getCurrent } from '@tauri-apps/api/window'
4-
import * as os from '@tauri-apps/api/os'
54
65
import Welcome from './views/Welcome.svelte'
76
import Cli from './views/Cli.svelte'
@@ -154,10 +153,7 @@
154153
document.addEventListener('mousemove', moveHandler)
155154
}
156155
157-
let isWindows
158-
onMount(async () => {
159-
isWindows = (await os.platform()) === 'win32'
160-
})
156+
const isWindows = navigator.appVersion.includes('Win')
161157
162158
// mobile
163159
let isSideBarOpen = false

tooling/api/docs/js-api.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tooling/api/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ import * as process from './process'
1919
import * as tauri from './tauri'
2020
import * as updater from './updater'
2121
import * as window from './window'
22-
import * as os from './os'
2322

2423
/** @ignore */
2524
const invoke = tauri.invoke
2625

27-
export { invoke, event, path, process, tauri, updater, window, os }
26+
export { invoke, event, path, process, tauri, updater, window }

tooling/api/src/os.ts

Lines changed: 0 additions & 164 deletions
This file was deleted.

0 commit comments

Comments
 (0)