various: consolidated dir exists+mkpath into one function

This commit is contained in:
itsmattkc
2022-04-07 17:11:50 -07:00
parent 20f74919a3
commit 48adb159b8
8 changed files with 14 additions and 30 deletions
+3 -3
View File
@@ -44,7 +44,7 @@ DiskManager::DiskManager()
QString default_dir = default_disk_cache_file.readAll();
if (!default_dir.isEmpty()) {
if (FileFunctions::DirectoryIsValid(default_dir, true)) {
if (FileFunctions::DirectoryIsValid(default_dir)) {
GetOpenFolder(default_dir);
} else {
QMessageBox::warning(nullptr,
@@ -180,7 +180,7 @@ void DiskManager::ShowDiskCacheSettingsDialog(DiskCacheFolder *folder, QWidget *
void DiskManager::ShowDiskCacheSettingsDialog(const QString &path, QWidget *parent)
{
if (!FileFunctions::DirectoryIsValid(path, true)) {
if (!FileFunctions::DirectoryIsValid(path)) {
QMessageBox::critical(parent, tr("Disk Cache Error"),
tr("Failed to open disk cache at \"%1\". Try a different folder.").arg(path));
return;
@@ -274,7 +274,7 @@ void DiskCacheFolder::SetPath(const QString &path)
// Attempt to load existing index file from path
QDir path_dir(path_);
path_dir.mkpath(QStringLiteral("."));
FileFunctions::DirectoryIsValid(path_dir);
index_path_ = path_dir.filePath(QStringLiteral("index"));