devoptab: fix create new mount entries failing if the mount folder didn't already exist.
This commit is contained in:
@@ -1606,6 +1606,7 @@ App::App(const char* argv0) {
|
|||||||
m_fs->CreateDirectory("/config/sphaira/themes");
|
m_fs->CreateDirectory("/config/sphaira/themes");
|
||||||
m_fs->CreateDirectory("/config/sphaira/github");
|
m_fs->CreateDirectory("/config/sphaira/github");
|
||||||
m_fs->CreateDirectory("/config/sphaira/i18n");
|
m_fs->CreateDirectory("/config/sphaira/i18n");
|
||||||
|
m_fs->CreateDirectory("/config/sphaira/mount");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
namespace sphaira::devoptab {
|
namespace sphaira::devoptab {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
#define MOUNT_PATH "/config/sphaira/mount/"
|
||||||
|
|
||||||
using namespace sphaira::ui;
|
using namespace sphaira::ui;
|
||||||
using namespace sphaira::devoptab::common;
|
using namespace sphaira::devoptab::common;
|
||||||
|
|
||||||
@@ -56,12 +58,12 @@ using TypeConfigs = std::vector<TypeConfig>;
|
|||||||
|
|
||||||
auto BuildIniPathFromType(DevoptabType type) -> fs::FsPath {
|
auto BuildIniPathFromType(DevoptabType type) -> fs::FsPath {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case DevoptabType::HTTP: return "/config/sphaira/mount/http.ini";
|
case DevoptabType::HTTP: return MOUNT_PATH "/http.ini";
|
||||||
case DevoptabType::FTP: return "/config/sphaira/mount/ftp.ini";
|
case DevoptabType::FTP: return MOUNT_PATH "/ftp.ini";
|
||||||
case DevoptabType::SFTP: return "/config/sphaira/mount/sftp.ini";
|
case DevoptabType::SFTP: return MOUNT_PATH "/sftp.ini";
|
||||||
case DevoptabType::NFS: return "/config/sphaira/mount/nfs.ini";
|
case DevoptabType::NFS: return MOUNT_PATH "/nfs.ini";
|
||||||
case DevoptabType::SMB: return "/config/sphaira/mount/smb.ini";
|
case DevoptabType::SMB: return MOUNT_PATH "/smb.ini";
|
||||||
case DevoptabType::WEBDAV: return "/config/sphaira/mount/webdav.ini";
|
case DevoptabType::WEBDAV: return MOUNT_PATH "/webdav.ini";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unreachable();
|
std::unreachable();
|
||||||
@@ -236,6 +238,7 @@ void DevoptabForm::SetupButtons(bool type_change) {
|
|||||||
|
|
||||||
const auto ini_path = BuildIniPathFromType(m_type);
|
const auto ini_path = BuildIniPathFromType(m_type);
|
||||||
|
|
||||||
|
fs::FsNativeSd().CreateDirectoryRecursively(MOUNT_PATH);
|
||||||
ini_puts(m_config.name.c_str(), "url", m_config.url.c_str(), ini_path);
|
ini_puts(m_config.name.c_str(), "url", m_config.url.c_str(), ini_path);
|
||||||
ini_puts(m_config.name.c_str(), "user", m_config.user.c_str(), ini_path);
|
ini_puts(m_config.name.c_str(), "user", m_config.user.c_str(), ini_path);
|
||||||
ini_puts(m_config.name.c_str(), "pass", m_config.pass.c_str(), ini_path);
|
ini_puts(m_config.name.c_str(), "pass", m_config.pass.c_str(), ini_path);
|
||||||
|
|||||||
Reference in New Issue
Block a user