fix
This commit is contained in:
parent
f9ec02bf3f
commit
a262a79eb2
@ -933,26 +933,18 @@ auto app_config::get_preferred_download_type() const -> download_type {
|
|||||||
auto app_config::get_provider_display_name(const provider_type &prov)
|
auto app_config::get_provider_display_name(const provider_type &prov)
|
||||||
-> std::string {
|
-> std::string {
|
||||||
static const std::array<std::string,
|
static const std::array<std::string,
|
||||||
static_cast<std::size_t>(provider_type::unknown+1U)>
|
static_cast<std::size_t>(provider_type::unknown) + 1U>
|
||||||
PROVIDER_DISPLAY_NAMES = {
|
PROVIDER_DISPLAY_NAMES = {
|
||||||
"Sia",
|
"Sia", "Remote", "S3", "Encrypt", "Unknown",
|
||||||
"Remote",
|
|
||||||
"S3",
|
|
||||||
"Encrypt",
|
|
||||||
"Unknown",
|
|
||||||
};
|
};
|
||||||
return PROVIDER_DISPLAY_NAMES.at(static_cast<std::size_t>(prov));
|
return PROVIDER_DISPLAY_NAMES.at(static_cast<std::size_t>(prov));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto app_config::get_provider_name(const provider_type &prov) -> std::string {
|
auto app_config::get_provider_name(const provider_type &prov) -> std::string {
|
||||||
static const std::array<std::string,
|
static const std::array<std::string,
|
||||||
static_cast<std::size_t>(provider_type::unknown+1U)>
|
static_cast<std::size_t>(provider_type::unknown) + 1U>
|
||||||
PROVIDER_NAMES = {
|
PROVIDER_NAMES = {
|
||||||
"sia",
|
"sia", "remote", "s3", "encrypt", "unknown",
|
||||||
"remote",
|
|
||||||
"s3",
|
|
||||||
"encrypt",
|
|
||||||
"unknown",
|
|
||||||
};
|
};
|
||||||
return PROVIDER_NAMES.at(static_cast<std::size_t>(prov));
|
return PROVIDER_NAMES.at(static_cast<std::size_t>(prov));
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
#include "providers/provider.hpp"
|
#include "providers/provider.hpp"
|
||||||
#include "types/repertory.hpp"
|
#include "types/repertory.hpp"
|
||||||
#include "utils/cli_utils.hpp"
|
#include "utils/cli_utils.hpp"
|
||||||
#include "utils/file.hpp"
|
|
||||||
#include "utils/com_init_wrapper.hpp"
|
#include "utils/com_init_wrapper.hpp"
|
||||||
|
#include "utils/file.hpp"
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
#include "drives/winfsp/remotewinfsp/remote_client.hpp"
|
||||||
@ -57,19 +57,19 @@ mount(std::vector<const char *> args, std::string data_directory,
|
|||||||
int &mount_result, provider_type prov, const std::string &remote_host,
|
int &mount_result, provider_type prov, const std::string &remote_host,
|
||||||
std::uint16_t remote_port, const std::string &unique_id) -> exit_code {
|
std::uint16_t remote_port, const std::string &unique_id) -> exit_code {
|
||||||
lock_data lock(prov, unique_id);
|
lock_data lock(prov, unique_id);
|
||||||
auto res = lock.grab_lock();
|
auto lock_result = lock.grab_lock();
|
||||||
if (res == lock_result::locked) {
|
if (lock_result == lock_result::locked) {
|
||||||
std::cerr << app_config::get_provider_display_name(prov)
|
std::cerr << app_config::get_provider_display_name(prov)
|
||||||
<< " mount is already active" << std::endl;
|
<< " mount is already active" << std::endl;
|
||||||
return exit_code::mount_active;
|
return exit_code::mount_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res != lock_result::success) {
|
if (lock_result != lock_result::success) {
|
||||||
return exit_code::lock_failed;
|
return exit_code::lock_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utils::cli::has_option(
|
if (utils::cli::has_option(args,
|
||||||
args, utils::cli::options::generate_config_option)) {
|
utils::cli::options::generate_config_option)) {
|
||||||
app_config config(prov, data_directory);
|
app_config config(prov, data_directory);
|
||||||
if (prov == provider_type::remote) {
|
if (prov == provider_type::remote) {
|
||||||
auto remote_config = config.get_remote_config();
|
auto remote_config = config.get_remote_config();
|
||||||
@ -86,8 +86,8 @@ mount(std::vector<const char *> args, std::string data_directory,
|
|||||||
<< " Configuration" << std::endl;
|
<< " Configuration" << std::endl;
|
||||||
std::cout << config.get_config_file_path() << std::endl;
|
std::cout << config.get_config_file_path() << std::endl;
|
||||||
return utils::file::file(config.get_config_file_path()).exists()
|
return utils::file::file(config.get_config_file_path()).exists()
|
||||||
? exit_code::success
|
? exit_code::success
|
||||||
: exit_code::file_creation_failed;
|
: exit_code::file_creation_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -100,8 +100,8 @@ mount(std::vector<const char *> args, std::string data_directory,
|
|||||||
app_config config(prov, data_directory);
|
app_config config(prov, data_directory);
|
||||||
{
|
{
|
||||||
lock_data global_lock(provider_type::unknown, "global");
|
lock_data global_lock(provider_type::unknown, "global");
|
||||||
res = global_lock.grab_lock();
|
lock_result = global_lock.grab_lock();
|
||||||
if (res != lock_result::success) {
|
if (lock_result != lock_result::success) {
|
||||||
return exit_code::lock_failed;
|
return exit_code::lock_failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,8 +146,8 @@ mount(std::vector<const char *> args, std::string data_directory,
|
|||||||
if (prov == provider_type::remote) {
|
if (prov == provider_type::remote) {
|
||||||
try {
|
try {
|
||||||
std::uint16_t port{};
|
std::uint16_t port{};
|
||||||
if (not utils::get_next_available_port(config.get_remote_config().api_port,
|
if (not utils::get_next_available_port(
|
||||||
port)) {
|
config.get_remote_config().api_port, port)) {
|
||||||
std::cerr << "FATAL: Unable to get available port" << std::endl;
|
std::cerr << "FATAL: Unable to get available port" << std::endl;
|
||||||
return exit_code::startup_exception;
|
return exit_code::startup_exception;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user