[ui] Add auto-mount on first launch functionality #52
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
Some checks are pending
BlockStorage/repertory/pipeline/head Build queued...
This commit is contained in:
@@ -251,6 +251,34 @@ void mgmt_app_config::set_auto_start(bool auto_start) {
|
||||
fmt::format("failed to remove auto-start entry"));
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#if defined(__APPLE__)
|
||||
auto label = "com.fifthgrid.blockstorage.repertory.ui";
|
||||
auto plist_file = utils::file::file{
|
||||
utils::path::combine("~", {"/Library/LaunchAgents", label})};
|
||||
if (auto_start) {
|
||||
if (not plist_file.exists()) {
|
||||
std::vector<std::string> args = {
|
||||
utils::path::combine(".", {"repertory"}),
|
||||
"-ui",
|
||||
"-lo",
|
||||
};
|
||||
|
||||
if (not utils::generate_launchd_plist(
|
||||
label, utils::path::combine("~", {"/Library/LaunchAgents"}),
|
||||
args, 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"));
|
||||
}
|
||||
}
|
||||
} else if (not plist_file.remove()) {
|
||||
utils::error::raise_error(
|
||||
function_name, utils::get_last_error_code(),
|
||||
fmt::format("failed to remove auto-start entry"));
|
||||
}
|
||||
#endif // defined(__APPLE__)
|
||||
} else {
|
||||
utils::error::raise_error(function_name, utils::get_last_error_code(),
|
||||
fmt::format("failed to change directory"));
|
||||
|
Reference in New Issue
Block a user