mirror of
https://github.com/Stremio/stremio-shell-ng.git
synced 2026-03-11 21:27:06 +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 std::os::windows::process::CommandExt;
|
||||
use std::process::Command;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
env, fs, os::windows::process::CommandExt, path, process::Command, thread, time::Duration,
|
||||
};
|
||||
use winapi::um::{
|
||||
processthreadsapi::GetCurrentProcess,
|
||||
winbase::CreateJobObjectA,
|
||||
|
|
@ -44,9 +43,15 @@ impl StremioServer {
|
|||
GetCurrentProcess(),
|
||||
);
|
||||
}
|
||||
let mut path = env::current_exe()
|
||||
.and_then(fs::canonicalize)
|
||||
.expect("Cannot get the current executable path");
|
||||
path.pop();
|
||||
loop {
|
||||
let child = Command::new("./stremio-runtime")
|
||||
.arg("server.js")
|
||||
let runtime_path = path.clone().join(path::Path::new("stremio-runtime"));
|
||||
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)
|
||||
.spawn();
|
||||
match child {
|
||||
|
|
|
|||
Loading…
Reference in a new issue