From 4a750c7b1619f1f6bbf886e78ca28bf2599cedbe Mon Sep 17 00:00:00 2001 From: Felipe Cavalcanti Date: Tue, 24 Aug 2021 21:13:33 -0300 Subject: [PATCH] fix: rename starting dir with working dir --- assets/web/apps.html | 18 +++++++++--------- sunshine/process.cpp | 14 +++++++------- sunshine/process.h | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/assets/web/apps.html b/assets/web/apps.html index 9dc6594a..c87dbc89 100644 --- a/assets/web/apps.html +++ b/assets/web/apps.html @@ -150,20 +150,20 @@ that sleeps indefinitely - +
- + -
- The starting dir that should be passed to the process. - Some apps needs this set to find configuration files for example. - If not set, will default to the parent directory of the command +
+ The working directory that should be passed to the process. + For example, some applications use the working directory to search for configuration files. + If not set, Sunshine will default to the parent directory of the command
diff --git a/sunshine/process.cpp b/sunshine/process.cpp index b0704d4b..f68593c0 100644 --- a/sunshine/process.cpp +++ b/sunshine/process.cpp @@ -111,15 +111,15 @@ int proc_t::execute(int app_id) { BOOST_LOG(debug) << "Executing [Desktop]"sv; placebo = true; } else { - boost::filesystem::path start_dir = proc.starting_dir.empty() ? - boost::filesystem::path(proc.cmd).parent_path() : boost::filesystem::path(proc.starting_dir); + boost::filesystem::path working_dir = proc.working_dir.empty() ? + boost::filesystem::path(proc.cmd).parent_path() : boost::filesystem::path(proc.working_dir); if(proc.output.empty() || proc.output == "null"sv) { BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']'; - _process = bp::child(_process_handle, proc.cmd, _env, bp::start_dir(start_dir), bp::std_out > bp::null, bp::std_err > bp::null, ec); + _process = bp::child(_process_handle, proc.cmd, _env, bp::start_dir(working_dir), bp::std_out > bp::null, bp::std_err > bp::null, ec); } else { BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']'; - _process = bp::child(_process_handle, proc.cmd, _env, bp::start_dir(start_dir), bp::std_out > _pipe.get(), bp::std_err > _pipe.get(), ec); + _process = bp::child(_process_handle, proc.cmd, _env, bp::start_dir(working_dir), bp::std_out > _pipe.get(), bp::std_err > _pipe.get(), ec); } } @@ -279,7 +279,7 @@ std::optional parse(const std::string &file_name) { auto output = app_node.get_optional("output"s); auto name = parse_env_val(this_env, app_node.get("name"s)); auto cmd = app_node.get_optional("cmd"s); - auto starting_dir = app_node.get_optional("startingDir"s); + auto working_dir = app_node.get_optional("working-dir"s); std::vector prep_cmds; if(prep_nodes_opt) { @@ -317,8 +317,8 @@ std::optional parse(const std::string &file_name) { ctx.cmd = parse_env_val(this_env, *cmd); } - if(starting_dir) { - ctx.starting_dir = parse_env_val(this_env, *starting_dir); + if(working_dir) { + ctx.working_dir = parse_env_val(this_env, *working_dir); } ctx.name = std::move(name); diff --git a/sunshine/process.h b/sunshine/process.h index ed0a3200..86016b64 100644 --- a/sunshine/process.h +++ b/sunshine/process.h @@ -34,7 +34,7 @@ struct cmd_t { * cmd -- Runs indefinitely until: * No session is running and a different set of commands it to be executed * Command exits - * starting_dir -- the process starting dir. This is required for some games to run properly. + * working_dir -- the process working directory. This is required for some games to run properly. * cmd_output -- * empty -- The output of the commands are appended to the output of sunshine * "null" -- The output of the commands are discarded @@ -53,7 +53,7 @@ struct ctx_t { std::string name; std::string cmd; - std::string starting_dir; + std::string working_dir; std::string output; };