fix: rename starting dir with working dir
This commit is contained in:
@@ -150,20 +150,20 @@
|
|||||||
that sleeps indefinitely
|
that sleeps indefinitely
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--starting dir-->
|
<!--working dir-->
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="appStartingDir" class="form-label">Starting Dir</label>
|
<label for="appWorkingDir" class="form-label">Working Directory</label>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
class="form-control monospace"
|
class="form-control monospace"
|
||||||
id="appStartindDir"
|
id="appWorkingDir"
|
||||||
aria-describedby="appStartindDirHelp"
|
aria-describedby="appWorkingDirHelp"
|
||||||
v-model="editForm.startingDir"
|
v-model="editForm['working-dir']"
|
||||||
/>
|
/>
|
||||||
<div id="appStartindDirHelp" class="form-text">
|
<div id="appWorkingDirHelp" class="form-text">
|
||||||
The starting dir that should be passed to the process.
|
The working directory that should be passed to the process.
|
||||||
Some apps needs this set to find configuration files for example.
|
For example, some applications use the working directory to search for configuration files.
|
||||||
If not set, will default to the parent directory of the command
|
If not set, Sunshine will default to the parent directory of the command
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--buttons-->
|
<!--buttons-->
|
||||||
|
|||||||
@@ -111,15 +111,15 @@ int proc_t::execute(int app_id) {
|
|||||||
BOOST_LOG(debug) << "Executing [Desktop]"sv;
|
BOOST_LOG(debug) << "Executing [Desktop]"sv;
|
||||||
placebo = true;
|
placebo = true;
|
||||||
} else {
|
} else {
|
||||||
boost::filesystem::path start_dir = proc.starting_dir.empty() ?
|
boost::filesystem::path working_dir = proc.working_dir.empty() ?
|
||||||
boost::filesystem::path(proc.cmd).parent_path() : boost::filesystem::path(proc.starting_dir);
|
boost::filesystem::path(proc.cmd).parent_path() : boost::filesystem::path(proc.working_dir);
|
||||||
if(proc.output.empty() || proc.output == "null"sv) {
|
if(proc.output.empty() || proc.output == "null"sv) {
|
||||||
BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']';
|
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 {
|
else {
|
||||||
BOOST_LOG(info) << "Executing: ["sv << proc.cmd << ']';
|
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<proc::proc_t> parse(const std::string &file_name) {
|
|||||||
auto output = app_node.get_optional<std::string>("output"s);
|
auto output = app_node.get_optional<std::string>("output"s);
|
||||||
auto name = parse_env_val(this_env, app_node.get<std::string>("name"s));
|
auto name = parse_env_val(this_env, app_node.get<std::string>("name"s));
|
||||||
auto cmd = app_node.get_optional<std::string>("cmd"s);
|
auto cmd = app_node.get_optional<std::string>("cmd"s);
|
||||||
auto starting_dir = app_node.get_optional<std::string>("startingDir"s);
|
auto working_dir = app_node.get_optional<std::string>("working-dir"s);
|
||||||
|
|
||||||
std::vector<proc::cmd_t> prep_cmds;
|
std::vector<proc::cmd_t> prep_cmds;
|
||||||
if(prep_nodes_opt) {
|
if(prep_nodes_opt) {
|
||||||
@@ -317,8 +317,8 @@ std::optional<proc::proc_t> parse(const std::string &file_name) {
|
|||||||
ctx.cmd = parse_env_val(this_env, *cmd);
|
ctx.cmd = parse_env_val(this_env, *cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(starting_dir) {
|
if(working_dir) {
|
||||||
ctx.starting_dir = parse_env_val(this_env, *starting_dir);
|
ctx.working_dir = parse_env_val(this_env, *working_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.name = std::move(name);
|
ctx.name = std::move(name);
|
||||||
|
|||||||
+2
-2
@@ -34,7 +34,7 @@ struct cmd_t {
|
|||||||
* cmd -- Runs indefinitely until:
|
* cmd -- Runs indefinitely until:
|
||||||
* No session is running and a different set of commands it to be executed
|
* No session is running and a different set of commands it to be executed
|
||||||
* Command exits
|
* 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 --
|
* cmd_output --
|
||||||
* empty -- The output of the commands are appended to the output of sunshine
|
* empty -- The output of the commands are appended to the output of sunshine
|
||||||
* "null" -- The output of the commands are discarded
|
* "null" -- The output of the commands are discarded
|
||||||
@@ -53,7 +53,7 @@ struct ctx_t {
|
|||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
std::string starting_dir;
|
std::string working_dir;
|
||||||
std::string output;
|
std::string output;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user