Skip to content

Commit d9b7a45

Browse files
committed
condition windows specific code for win build only
1 parent ad852a3 commit d9b7a45

File tree

4 files changed

+49
-29
lines changed

4 files changed

+49
-29
lines changed

src-tauri/src/injector.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
#[cfg(target_os = "windows")]
22
use dll_syringe::{process::OwnedProcess, Syringe};
3+
#[cfg(target_os = "windows")]
34
use log::info;
5+
#[cfg(target_os = "windows")]
46
use regex::Regex;
7+
#[cfg(target_os = "windows")]
58
use std::process::Command;
9+
#[cfg(target_os = "windows")]
610
use tokio::net::lookup_host;
711

812
#[cfg(not(target_os = "windows"))]
913
pub async fn run_samp(
10-
name: &str,
11-
ip: &str,
12-
port: i32,
13-
executable_dir: &str,
14-
dll_path: &str,
15-
omp_file: &str,
16-
password: &str,
17-
discord: bool,
14+
_name: &str,
15+
_ip: &str,
16+
_port: i32,
17+
_executable_dir: &str,
18+
_dll_path: &str,
19+
_omp_file: &str,
20+
_password: &str,
21+
_discord: bool,
1822
) -> Result<(), String> {
1923
Ok(())
2024
}

src-tauri/src/main.rs

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use tauri::Manager;
2222
use tauri::PhysicalSize;
2323

2424
#[path = "deeplink/lib.rs"]
25+
#[cfg(target_os = "windows")]
2526
mod deeplink;
2627

2728
#[derive(Debug, Options)]
@@ -62,7 +63,11 @@ async fn main() {
6263
// let digest = md5::compute(contents.as_slice());
6364
// println!("{:x}", digest);
6465

65-
deeplink::prepare("mp.open.launcher");
66+
#[cfg(windows)]
67+
{
68+
deeplink::prepare("mp.open.launcher");
69+
}
70+
6671
simple_logging::log_to_file("omp-launcher.log", LevelFilter::Info).unwrap();
6772

6873
#[cfg(windows)]
@@ -156,31 +161,35 @@ Options:
156161
match tauri::Builder::default()
157162
.plugin(tauri_plugin_upload::init())
158163
.setup(|app| {
159-
let handle = app.handle();
160-
let handle2 = app.handle();
161164
let main_window = app.get_window("main").unwrap();
162165
main_window
163166
.set_min_size(Some(PhysicalSize::new(1000, 700)))
164167
.unwrap();
165168

166-
deeplink::register("omp", move |request| {
167-
dbg!(&request);
168-
let mut uri_scheme_value = URI_SCHEME_VALUE.lock().unwrap();
169-
*uri_scheme_value = String::from(request.as_str());
170-
handle.emit_all("scheme-request-received", request).unwrap();
171-
})
172-
.unwrap();
169+
#[cfg(windows)]
170+
{
171+
let handle = app.handle();
172+
let handle2 = app.handle();
173+
174+
deeplink::register("omp", move |request| {
175+
dbg!(&request);
176+
let mut uri_scheme_value = URI_SCHEME_VALUE.lock().unwrap();
177+
*uri_scheme_value = String::from(request.as_str());
178+
handle.emit_all("scheme-request-received", request).unwrap();
179+
})
180+
.unwrap();
173181

174-
deeplink::register("samp", move |request| {
175-
dbg!(&request);
176-
let mut uri_scheme_value = URI_SCHEME_VALUE.lock().unwrap();
177-
(*uri_scheme_value).clone_from(&request);
178-
*uri_scheme_value = String::from(request.as_str());
179-
handle2
180-
.emit_all("scheme-request-received", request)
181-
.unwrap();
182-
})
183-
.unwrap();
182+
deeplink::register("samp", move |request| {
183+
dbg!(&request);
184+
let mut uri_scheme_value = URI_SCHEME_VALUE.lock().unwrap();
185+
(*uri_scheme_value).clone_from(&request);
186+
*uri_scheme_value = String::from(request.as_str());
187+
handle2
188+
.emit_all("scheme-request-received", request)
189+
.unwrap();
190+
})
191+
.unwrap();
192+
}
184193

185194
Ok(())
186195
})

src-tauri/src/samp.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
1+
#[cfg(target_os = "windows")]
12
use crate::helpers;
3+
#[cfg(target_os = "windows")]
24
use byteorder::{LittleEndian, ReadBytesExt};
35
use serde::{Deserialize, Serialize};
6+
#[cfg(target_os = "windows")]
47
use std::fs::File;
8+
#[cfg(target_os = "windows")]
59
use std::io::Cursor;
10+
#[cfg(target_os = "windows")]
611
use std::io::Read;
12+
#[cfg(target_os = "windows")]
713
use std::path::Path;
14+
#[cfg(target_os = "windows")]
815
use tauri::api::path::document_dir;
916
#[cfg(target_os = "windows")]
1017
use winreg::enums::*;

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
},
3131
"fs": {
3232
"all": true,
33-
"scope": ["**"],
33+
"scope": ["**", "**/*", "/**/*", "$HOME/.local/**"],
3434
"exists": true
3535
},
3636
"shell": {

0 commit comments

Comments
 (0)