[ui] Add auto-mount on first launch functionality #52
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-09-06 17:08:59 -05:00
parent 39b5491c52
commit f4a7e0e187
4 changed files with 14 additions and 11 deletions

View File

@@ -57,13 +57,12 @@ void windows_create_to_unix(const UINT32 &create_options,
const UINT32 &granted_access, std::uint32_t &flags,
remote::file_mode &mode);
#if defined(__APPLE__)
[[nodiscard]] auto
generate_launchd_plist(const std::string &label, std::string plist_path,
const std::vector<std::string> &args,
const std::string &working_dir = "/tmp",
const std::string &stdout_log = "/tmp/stdout.log",
const std::string &stderr_log = "/tmp/stderr.log")
-> bool;
[[nodiscard]] auto generate_launchd_plist(
const std::string &label, std::string plist_path,
const std::vector<std::string> &args, bool run_at_load = false,
bool keep_alive = false, const std::string &working_dir = "/tmp",
const std::string &stdout_log = "/tmp/stdout.log",
const std::string &stderr_log = "/tmp/stderr.log") -> bool;
[[nodiscard]] auto launchctl_command(std::string_view label,
launchctl_type type) -> int;

View File

@@ -450,7 +450,7 @@ auto fuse_base::mount([[maybe_unused]] std::vector<std::string> orig_args,
if (not utils::generate_launchd_plist(
label_, utils::path::combine("~", {"/Library/LaunchAgents"}),
orig_args, utils::path::absolute("."),
orig_args, false, false, utils::path::absolute("."),
fmt::format("/tmp/repertory_{}_{}.out",
provider_type_to_string(prov), unique_id),
fmt::format("/tmp/repertory_{}_{}.err",

View File

@@ -310,6 +310,7 @@ auto create_daemon(std::function<int()> main_func) -> int {
#if defined(__APPLE__)
auto generate_launchd_plist(const std::string &label, std::string plist_path,
const std::vector<std::string> &args,
bool run_at_load, bool keep_alive,
const std::string &working_dir,
const std::string &stdout_log,
const std::string &stderr_log) -> bool {
@@ -349,7 +350,10 @@ auto generate_launchd_plist(const std::string &label, std::string plist_path,
dict.append_child("string").text().set(working_dir.c_str());
dict.append_child("key").text().set("KeepAlive");
dict.append_child("false");
dict.append_child(keep_alive ? "true" : "false");
dict.append_child("key").text().set("RunAtLoad");
dict.append_child(run_at_load ? "true" : "false");
dict.append_child("key").text().set("StandardOutPath");
dict.append_child("string").text().set(stdout_log.c_str());

View File

@@ -267,8 +267,8 @@ void mgmt_app_config::set_auto_start(bool auto_start) {
if (not utils::generate_launchd_plist(
label, utils::path::combine("~", {"/Library/LaunchAgents"}),
args, utils::path::absolute("."), "/tmp/repertory_ui.out",
"/tmp/repertory_ui.err")) {
args, true, false, utils::path::absolute("."),
"/tmp/repertory_ui.out", "/tmp/repertory_ui.err")) {
utils::error::raise_error(
function_name, utils::get_last_error_code(),
fmt::format("failed to create auto-start entry"));