fix
This commit is contained in:
@ -55,7 +55,7 @@ public:
|
||||
get_provider_name(const provider_type &prov) -> std::string;
|
||||
|
||||
public:
|
||||
app_config(const provider_type &prov, const std::string &data_directory = "");
|
||||
app_config(const provider_type &prov, std::string_view data_directory = "");
|
||||
|
||||
~app_config() { save(); }
|
||||
|
||||
|
@ -54,7 +54,7 @@ constexpr const auto retry_save_count = 5U;
|
||||
|
||||
namespace repertory {
|
||||
app_config::app_config(const provider_type &prov,
|
||||
const std::string &data_directory)
|
||||
std::string_view data_directory)
|
||||
: prov_(prov),
|
||||
api_auth_(utils::generate_random_string(default_api_auth_size)),
|
||||
api_port_(default_rpc_port(prov)),
|
||||
@ -151,19 +151,28 @@ auto app_config::default_api_port(const provider_type &prov) -> std::uint16_t {
|
||||
auto app_config::default_data_directory(const provider_type &prov)
|
||||
-> std::string {
|
||||
#if defined(_WIN32)
|
||||
auto data_directory = utils::path::combine(
|
||||
utils::get_local_app_data_directory(),
|
||||
{std::string{REPERTORY_DATA_NAME}, app_config::get_provider_name(prov)});
|
||||
auto data_directory =
|
||||
utils::path::combine(utils::get_local_app_data_directory(),
|
||||
{
|
||||
REPERTORY_DATA_NAME,
|
||||
app_config::get_provider_name(prov),
|
||||
});
|
||||
#else
|
||||
#if defined(__APPLE__)
|
||||
auto data_directory =
|
||||
utils::path::resolve(std::string{"~/Library/Application Support/"} +
|
||||
std::string{REPERTORY_DATA_NAME} + '/' +
|
||||
app_config::get_provider_name(prov));
|
||||
auto data_directory = utils::path::resolve(
|
||||
utils::path::combine("~", {
|
||||
"Library",
|
||||
"Application Support",
|
||||
REPERTORY_DATA_NAME,
|
||||
app_config::get_provider_name(prov),
|
||||
}));
|
||||
#else
|
||||
auto data_directory = utils::path::resolve(
|
||||
std::string{"~/.local/"} + std::string{REPERTORY_DATA_NAME} + '/' +
|
||||
app_config::get_provider_name(prov));
|
||||
utils::path::combine("~", {
|
||||
".local",
|
||||
REPERTORY_DATA_NAME,
|
||||
app_config::get_provider_name(prov),
|
||||
}));
|
||||
#endif
|
||||
#endif
|
||||
return data_directory;
|
||||
@ -528,6 +537,7 @@ auto app_config::load() -> bool {
|
||||
auto ret = false;
|
||||
|
||||
const auto config_file_path = get_config_file_path();
|
||||
std::cout << config_file_path << std::endl;
|
||||
recur_mutex_lock lock(read_write_mutex_);
|
||||
if (utils::file::is_file(config_file_path)) {
|
||||
try {
|
||||
|
@ -91,6 +91,7 @@ mount(std::vector<const char *> args, std::string data_directory,
|
||||
#endif
|
||||
const auto drive_args =
|
||||
utils::cli::parse_drive_options(args, prov, data_directory);
|
||||
std::cout << data_directory << std::endl;
|
||||
app_config config(prov, data_directory);
|
||||
#if defined(_WIN32)
|
||||
if (config.get_enable_mount_manager() &&
|
||||
|
Reference in New Issue
Block a user