mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2026-02-06 02:06:29 +01:00
program opening command
This commit is contained in:
13
src-tauri/Cargo.lock
generated
13
src-tauri/Cargo.lock
generated
@@ -258,7 +258,9 @@ version = "0.2.17"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"lazy_static",
|
||||||
"memchr",
|
"memchr",
|
||||||
|
"regex-automata",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -640,6 +642,7 @@ name = "cultivation"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hudsucker",
|
"hudsucker",
|
||||||
|
"opener",
|
||||||
"rustls-pemfile",
|
"rustls-pemfile",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
@@ -2165,6 +2168,16 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "opener"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4ea3ebcd72a54701f56345f16785a6d3ac2df7e986d273eb4395c0b01db17952"
|
||||||
|
dependencies = [
|
||||||
|
"bstr",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.10.40"
|
version = "0.10.40"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ tauri-build = { version = "1.0.0-rc.8", features = [] }
|
|||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
tauri = { version = "1.0.0-rc.9", features = ["api-all"] }
|
tauri = { version = "1.0.0-rc.9", features = ["api-all"] }
|
||||||
|
opener = "0.5.0"
|
||||||
hudsucker = "0.17.2"
|
hudsucker = "0.17.2"
|
||||||
tracing = "0.1.34"
|
tracing = "0.1.34"
|
||||||
tokio-rustls = "0.23.4"
|
tokio-rustls = "0.23.4"
|
||||||
|
|||||||
@@ -8,13 +8,20 @@ mod proxy;
|
|||||||
use tauri::{
|
use tauri::{
|
||||||
command
|
command
|
||||||
};
|
};
|
||||||
|
use opener;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
tauri::Builder::default()
|
tauri::Builder::default()
|
||||||
|
.invoke_handler(tauri::generate_handler![run_program])
|
||||||
.run(tauri::generate_context!())
|
.run(tauri::generate_context!())
|
||||||
.expect("error while running tauri application");
|
.expect("error while running tauri application");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tauri::command]
|
||||||
|
fn run_program(path: String) {
|
||||||
|
opener::open(path.clone());
|
||||||
|
}
|
||||||
|
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
fn connect() {
|
fn connect() {
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,22 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import logo from './logo.svg'
|
import { invoke } from '@tauri-apps/api/tauri'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
import './custom.css'
|
import './custom.css'
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
import { getConfigOption, getConfig, saveConfig, setConfigOption } from '../utils/configuration'
|
import { getConfig } from '../utils/configuration'
|
||||||
|
|
||||||
// Major Components
|
// Major Components
|
||||||
import Topbar from './components/TopBar'
|
import Topbar from './components/TopBar'
|
||||||
import BigButton from './components/common/BigButton'
|
import BigButton from './components/common/BigButton'
|
||||||
|
|
||||||
function playGame() {
|
async function playGame() {
|
||||||
|
const config = await getConfig()
|
||||||
|
|
||||||
|
if (!config.game_path) return
|
||||||
|
|
||||||
|
// Launch the program
|
||||||
|
await invoke('run_program', { path: config.game_path })
|
||||||
}
|
}
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|||||||
Reference in New Issue
Block a user