mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-04-21 16:01:56 +00:00
Execute the server from the same directory the main executable is
This commit is contained in:
parent
f76435e745
commit
b8c68029ed
1 changed files with 77 additions and 72 deletions
|
|
@ -1,8 +1,7 @@
|
||||||
use native_windows_gui as nwg;
|
use native_windows_gui as nwg;
|
||||||
use std::os::windows::process::CommandExt;
|
use std::{
|
||||||
use std::process::Command;
|
env, fs, os::windows::process::CommandExt, path, process::Command, thread, time::Duration,
|
||||||
use std::thread;
|
};
|
||||||
use std::time::Duration;
|
|
||||||
use winapi::um::{
|
use winapi::um::{
|
||||||
processthreadsapi::GetCurrentProcess,
|
processthreadsapi::GetCurrentProcess,
|
||||||
winbase::CreateJobObjectA,
|
winbase::CreateJobObjectA,
|
||||||
|
|
@ -44,9 +43,15 @@ impl StremioServer {
|
||||||
GetCurrentProcess(),
|
GetCurrentProcess(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
let mut path = env::current_exe()
|
||||||
|
.and_then(fs::canonicalize)
|
||||||
|
.expect("Cannot get the current executable path");
|
||||||
|
path.pop();
|
||||||
loop {
|
loop {
|
||||||
let child = Command::new("./stremio-runtime")
|
let runtime_path = path.clone().join(path::Path::new("stremio-runtime"));
|
||||||
.arg("server.js")
|
let server_path = path.clone().join(path::Path::new("server.js"));
|
||||||
|
let child = Command::new(runtime_path)
|
||||||
|
.arg(server_path)
|
||||||
.creation_flags(CREATE_NO_WINDOW)
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
.spawn();
|
.spawn();
|
||||||
match child {
|
match child {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue