summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-10-05 01:47:27 +0200
committerPetr Mrázek <peterix@gmail.com>2015-10-05 01:47:27 +0200
commitf93f867c3da084c6d6c5e3ed23896609cff0e692 (patch)
tree3234c54d9aefb5566afc0c8ff52874e20ab35304 /application
parent7459eb627c97d27ef6e12cdededa48e1ff03d533 (diff)
downloadMultiMC-f93f867c3da084c6d6c5e3ed23896609cff0e692.tar
MultiMC-f93f867c3da084c6d6c5e3ed23896609cff0e692.tar.gz
MultiMC-f93f867c3da084c6d6c5e3ed23896609cff0e692.tar.lz
MultiMC-f93f867c3da084c6d6c5e3ed23896609cff0e692.tar.xz
MultiMC-f93f867c3da084c6d6c5e3ed23896609cff0e692.zip
NOISSUE dissolve util library
Diffstat (limited to 'application')
-rw-r--r--application/CMakeLists.txt2
-rw-r--r--application/InstancePageProvider.h6
-rw-r--r--application/MainWindow.cpp39
-rw-r--r--application/MultiMC.cpp45
-rw-r--r--application/VersionProxyModel.cpp4
-rw-r--r--application/dialogs/CopyInstanceDialog.cpp18
-rw-r--r--application/dialogs/CopyInstanceDialog.h3
-rw-r--r--application/dialogs/CopyInstanceDialog.ui11
-rw-r--r--application/dialogs/ExportInstanceDialog.cpp11
-rw-r--r--application/dialogs/VersionSelectDialog.cpp1
-rw-r--r--application/pages/InstanceSettingsPage.cpp4
-rw-r--r--application/pages/LegacyJarModPage.cpp5
-rw-r--r--application/pages/ModFolderPage.cpp5
-rw-r--r--application/pages/OtherLogsPage.cpp10
-rw-r--r--application/pages/ScreenshotsPage.cpp8
-rw-r--r--application/pages/VersionPage.cpp1
-rw-r--r--application/pages/WorldListPage.cpp3
-rw-r--r--application/pages/WorldListPage.h1
-rw-r--r--application/pages/global/ExternalToolsPage.cpp11
-rw-r--r--application/pages/global/JavaPage.cpp5
-rw-r--r--application/pages/global/MinecraftPage.cpp2
-rw-r--r--application/pages/global/MultiMCPage.cpp20
-rw-r--r--application/pages/global/PasteEEPage.cpp2
23 files changed, 116 insertions, 101 deletions
diff --git a/application/CMakeLists.txt b/application/CMakeLists.txt
index fdb27607..d9c37a45 100644
--- a/application/CMakeLists.txt
+++ b/application/CMakeLists.txt
@@ -348,7 +348,7 @@ qt5_add_resources(MULTIMC_RESOURCES ${MULTIMC_QRCS})
# Add executable
add_executable(MultiMC MACOSX_BUNDLE WIN32 ${MULTIMC_SOURCES} ${MULTIMC_UI} ${MULTIMC_RESOURCES} ${MULTIMC_RCS})
-target_link_libraries(MultiMC MultiMC_logic xz-embedded unpack200 iconfix MultiMC_util ${QUAZIP_LIBRARIES} hoedown rainbow)
+target_link_libraries(MultiMC MultiMC_logic xz-embedded unpack200 iconfix ${QUAZIP_LIBRARIES} hoedown rainbow)
if(APPLE)
find_library(OSX_CORE_FOUNDATION CoreFoundation)
diff --git a/application/InstancePageProvider.h b/application/InstancePageProvider.h
index c3ae17c1..1b283896 100644
--- a/application/InstancePageProvider.h
+++ b/application/InstancePageProvider.h
@@ -1,6 +1,7 @@
#pragma once
#include "minecraft/OneSixInstance.h"
#include "minecraft/LegacyInstance.h"
+#include <FileSystem.h>
#include "pages/BasePage.h"
#include "pages/VersionPage.h"
#include "pages/ModFolderPage.h"
@@ -13,7 +14,6 @@
#include "pages/BasePageProvider.h"
#include "pages/LegacyJarModPage.h"
#include "pages/WorldListPage.h"
-#include <pathutils.h>
class InstancePageProvider : public QObject, public BasePageProvider
@@ -41,7 +41,7 @@ public:
values.append(new TexturePackPage(onesix.get()));
values.append(new NotesPage(onesix.get()));
values.append(new WorldListPage(onesix.get(), onesix->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
- values.append(new ScreenshotsPage(PathCombine(onesix->minecraftRoot(), "screenshots")));
+ values.append(new ScreenshotsPage(FS::PathCombine(onesix->minecraftRoot(), "screenshots")));
values.append(new InstanceSettingsPage(onesix.get()));
}
std::shared_ptr<LegacyInstance> legacy = std::dynamic_pointer_cast<LegacyInstance>(inst);
@@ -57,7 +57,7 @@ public:
values.append(new TexturePackPage(legacy.get()));
values.append(new NotesPage(legacy.get()));
values.append(new WorldListPage(legacy.get(), legacy->worldList(), "worlds", "worlds", tr("Worlds"), "Worlds"));
- values.append(new ScreenshotsPage(PathCombine(legacy->minecraftRoot(), "screenshots")));
+ values.append(new ScreenshotsPage(FS::PathCombine(legacy->minecraftRoot(), "screenshots")));
values.append(new InstanceSettingsPage(legacy.get()));
}
auto logMatcher = inst->getLogFileMatcher();
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index 1562efc5..71888870 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -331,10 +331,6 @@ namespace Ui {
#include <MMCZip.h>
-#include "osutils.h"
-#include "userutils.h"
-#include "pathutils.h"
-
#include "groupview/GroupView.h"
#include "groupview/InstanceDelegate.h"
#include "InstanceProxyModel.h"
@@ -972,8 +968,8 @@ void MainWindow::downloadUpdates(GoUpdate::Status status)
ProgressDialog updateDlg(this);
status.rootPath = MMC->rootPath;
- auto dlPath = PathCombine(MMC->root(), "update", "XXXXXX");
- if(!ensureFilePathExists(dlPath))
+ auto dlPath = FS::PathCombine(MMC->root(), "update", "XXXXXX");
+ if(!FS::ensureFilePathExists(dlPath))
{
CustomMessageBox::selectable(this, tr("Error"), tr("Couldn't create folder for update downloads:\n%1").arg(dlPath), QMessageBox::Warning)->show();
}
@@ -1053,8 +1049,8 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup,
InstancePtr newInstance;
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(instName, instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
+ QString instDirName = FS::DirNameFromString(instName, instancesDir);
+ QString instDir = FS::PathCombine(instancesDir, instDirName);
QString archivePath;
if (url.isLocalFile())
@@ -1094,7 +1090,7 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup,
CustomMessageBox::selectable(this, tr("Error"), tr("Archive does not contain instance.cfg"))->show();
return nullptr;
}
- if (!copyPath(instanceCfgFile.absoluteDir().absolutePath(), instDir))
+ if (!FS::copyPath(instanceCfgFile.absoluteDir().absolutePath(), instDir))
{
CustomMessageBox::selectable(this, tr("Error"), tr("Unable to copy instance"))->show();
return nullptr;
@@ -1124,7 +1120,7 @@ InstancePtr MainWindow::instanceFromZipPack(QString instName, QString instGroup,
else
{
instIcon = newInstance->iconKey();
- auto importIconPath = PathCombine(newInstance->instanceRoot(), instIcon + ".png");
+ auto importIconPath = FS::PathCombine(newInstance->instanceRoot(), instIcon + ".png");
if (QFile::exists(importIconPath))
{
// import icon
@@ -1153,8 +1149,8 @@ InstancePtr MainWindow::instanceFromVersion(QString instName, QString instGroup,
InstancePtr newInstance;
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(instName, instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
+ QString instDirName = FS::DirNameFromString(instName, instancesDir);
+ QString instDir = FS::PathCombine(instancesDir, instDirName);
auto error = MMC->instances()->createInstance(newInstance, version, instDir);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
@@ -1257,11 +1253,12 @@ void MainWindow::on_actionCopyInstance_triggered()
return;
QString instancesDir = MMC->settings()->get("InstanceDir").toString();
- QString instDirName = DirNameFromString(copyInstDlg.instName(), instancesDir);
- QString instDir = PathCombine(instancesDir, instDirName);
+ QString instDirName = FS::DirNameFromString(copyInstDlg.instName(), instancesDir);
+ QString instDir = FS::PathCombine(instancesDir, instDirName);
+ bool copySaves = copyInstDlg.shouldCopySaves();
InstancePtr newInstance;
- auto error = MMC->instances()->copyInstance(newInstance, m_selectedInstance, instDir);
+ auto error = MMC->instances()->copyInstance(newInstance, m_selectedInstance, instDir, copySaves);
QString errorMsg = tr("Failed to create instance %1: ").arg(instDirName);
switch (error)
@@ -1359,7 +1356,7 @@ void MainWindow::on_actionChangeInstGroup_triggered()
void MainWindow::on_actionViewInstanceFolder_triggered()
{
QString str = MMC->settings()->get("InstanceDir").toString();
- openDirInDefaultProgram(str);
+ FS::openDirInDefaultProgram(str);
}
void MainWindow::on_actionRefresh_triggered()
@@ -1369,7 +1366,7 @@ void MainWindow::on_actionRefresh_triggered()
void MainWindow::on_actionViewCentralModsFolder_triggered()
{
- openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true);
+ FS::openDirInDefaultProgram(MMC->settings()->get("CentralModsDir").toString(), true);
}
void MainWindow::on_actionConfig_Folder_triggered()
@@ -1377,7 +1374,7 @@ void MainWindow::on_actionConfig_Folder_triggered()
if (m_selectedInstance)
{
QString str = m_selectedInstance->instanceConfigFolder();
- openDirInDefaultProgram(QDir(str).absolutePath());
+ FS::openDirInDefaultProgram(QDir(str).absolutePath());
}
}
@@ -1509,7 +1506,7 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered()
if (m_selectedInstance)
{
QString str = m_selectedInstance->instanceRoot();
- openDirInDefaultProgram(QDir(str).absolutePath());
+ FS::openDirInDefaultProgram(QDir(str).absolutePath());
}
}
@@ -1677,7 +1674,7 @@ void MainWindow::checkSetDefaultJava()
break;
}
QString currentJavaPath = MMC->settings()->get("JavaPath").toString();
- QString actualPath = ResolveExecutable(currentJavaPath);
+ QString actualPath = FS::ResolveExecutable(currentJavaPath);
if (currentJavaPath.isNull())
{
askForJava = true;
@@ -1738,7 +1735,7 @@ void MainWindow::checkSetDefaultJava()
void MainWindow::checkInstancePathForProblems()
{
QString instanceFolder = MMC->settings()->get("InstanceDir").toString();
- if (checkProblemticPathJava(QDir(instanceFolder)))
+ if (FS::checkProblemticPathJava(QDir(instanceFolder)))
{
QMessageBox warning(this);
warning.setText(tr(
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 612ba342..5584de1f 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -41,8 +41,6 @@
#include "tools/JVisualVM.h"
#include "tools/MCEditTool.h"
-#include "pathutils.h"
-#include "cmdutils.h"
#include <xdgicon.h>
#include "settings/INISettingsObject.h"
#include "settings/Setting.h"
@@ -54,7 +52,10 @@
#include "ftb/FTBPlugin.h"
-using namespace Util::Commandline;
+#include <Commandline.h>
+#include <FileSystem.h>
+
+using namespace Commandline;
MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, argv)
{
@@ -142,7 +143,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
launchId = args["launch"].toString();
- if (!ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath))
+ if (!FS::ensureFolderPathExists(dataPath) || !QDir::setCurrent(dataPath))
{
// BAD STUFF. WHAT DO?
initLogger();
@@ -159,7 +160,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
else
{
#ifdef Q_OS_LINUX
- QDir foo(PathCombine(binPath, ".."));
+ QDir foo(FS::PathCombine(binPath, ".."));
rootPath = foo.absolutePath();
#elif defined(Q_OS_WIN32)
rootPath = binPath;
@@ -171,12 +172,12 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
// static data paths... mostly just for translations
#ifdef Q_OS_LINUX
- QDir foo(PathCombine(binPath, ".."));
+ QDir foo(FS::PathCombine(binPath, ".."));
staticDataPath = foo.absolutePath();
#elif defined(Q_OS_WIN32)
staticDataPath = binPath;
#elif defined(Q_OS_MAC)
- QDir foo(PathCombine(rootPath, "Contents/Resources"));
+ QDir foo(FS::PathCombine(rootPath, "Contents/Resources"));
staticDataPath = foo.absolutePath();
#endif
@@ -220,7 +221,7 @@ MultiMC::MultiMC(int &argc, char **argv, bool test_mode) : QApplication(argc, ar
// and rememer that we have to show him a dialog when the gui starts (if it does so)
QString instDir = m_settings->get("InstanceDir").toString();
qDebug() << "Instance path : " << instDir;
- if (checkProblemticPathJava(QDir(instDir)))
+ if (FS::checkProblemticPathJava(QDir(instDir)))
{
qWarning()
<< "Your instance path contains \'!\' and this is known to cause java problems";
@@ -671,26 +672,26 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
bool started = false;
qDebug() << "Installing updates.";
-#ifdef WINDOWS
+#ifdef Q_OS_WIN
QString finishCmd = applicationFilePath();
-#elif LINUX
- QString finishCmd = PathCombine(root(), "MultiMC");
-#elif OSX
+#elif defined Q_OS_LINUX
+ QString finishCmd = FS::PathCombine(root(), "MultiMC");
+#elif defined Q_OS_MAC
QString finishCmd = applicationFilePath();
#else
#error Unsupported operating system.
#endif
- QString backupPath = PathCombine(root(), "update", "backup");
+ QString backupPath = FS::PathCombine(root(), "update", "backup");
QDir origin(root());
// clean up the backup folder. it should be empty before we start
- if(!deletePath(backupPath))
+ if(!FS::deletePath(backupPath))
{
qWarning() << "couldn't remove previous backup folder" << backupPath;
}
// and it should exist.
- if(!ensureFolderPathExists(backupPath))
+ if(!FS::ensureFolderPathExists(backupPath))
{
qWarning() << "couldn't create folder" << backupPath;
return;
@@ -726,7 +727,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
// replace = move original out to backup, if it exists, move the new file in its place
case GoUpdate::Operation::OP_REPLACE:
{
- QFileInfo replaced (PathCombine(root(), op.dest));
+ QFileInfo replaced (FS::PathCombine(root(), op.dest));
#ifdef Q_OS_WIN32
if(QSysInfo::windowsVersion() < QSysInfo::WV_VISTA)
{
@@ -735,7 +736,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
QDir rootDir(root());
exeOrigin = rootDir.relativeFilePath(op.file);
exePath = rootDir.relativeFilePath(op.dest);
- exeBackup = rootDir.relativeFilePath(PathCombine(backupPath, replaced.fileName()));
+ exeBackup = rootDir.relativeFilePath(FS::PathCombine(backupPath, replaced.fileName()));
useXPHack = true;
continue;
}
@@ -745,7 +746,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
{
QString backupName = op.dest;
backupName.replace('/', '_');
- QString backupFilePath = PathCombine(backupPath, backupName);
+ QString backupFilePath = FS::PathCombine(backupPath, backupName);
if(!QFile::rename(replaced.absoluteFilePath(), backupFilePath))
{
qWarning() << "Couldn't move:" << replaced.absoluteFilePath() << "to" << backupFilePath;
@@ -759,7 +760,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
backups.append(be);
}
// make sure the folder we are putting this into exists
- if(!ensureFilePathExists(replaced.absoluteFilePath()))
+ if(!FS::ensureFilePathExists(replaced.absoluteFilePath()))
{
qWarning() << "REPLACE: Couldn't create folder:" << replaced.absoluteFilePath();
failedOperationType = Replace;
@@ -780,12 +781,12 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
// delete = move original to backup
case GoUpdate::Operation::OP_DELETE:
{
- QString origFilePath = PathCombine(root(), op.file);
+ QString origFilePath = FS::PathCombine(root(), op.file);
if(QFile::exists(origFilePath))
{
QString backupName = op.file;
backupName.replace('/', '_');
- QString trashFilePath = PathCombine(backupPath, backupName);
+ QString trashFilePath = FS::PathCombine(backupPath, backupName);
if(!QFile::rename(origFilePath, trashFilePath))
{
@@ -825,7 +826,7 @@ void MultiMC::installUpdates(const QString updateFilesDir, GoUpdate::OperationLi
out << "fso.MoveFile \"" << nativeOriginPath << "\", \"" << nativePath << "\"\n";
out << "shell.Run \"" << nativePath << "\"\n";
- QString scriptPath = PathCombine(root(), "update", "update.vbs");
+ QString scriptPath = FS::PathCombine(root(), "update", "update.vbs");
// we save it
QFile scriptFile(scriptPath);
diff --git a/application/VersionProxyModel.cpp b/application/VersionProxyModel.cpp
index 4db5cbd0..70894592 100644
--- a/application/VersionProxyModel.cpp
+++ b/application/VersionProxyModel.cpp
@@ -2,7 +2,7 @@
#include "MultiMC.h"
#include <QSortFilterProxyModel>
#include <QPixmapCache>
-#include <modutils.h>
+#include <Version.h>
class VersionFilterModel : public QSortFilterProxyModel
{
@@ -35,7 +35,7 @@ public:
return false;
}
}
- else if (!Util::versionIsInInterval(versionString, it.value().string))
+ else if (!versionIsInInterval(versionString, it.value().string))
{
return false;
}
diff --git a/application/dialogs/CopyInstanceDialog.cpp b/application/dialogs/CopyInstanceDialog.cpp
index 54c42f29..67e2e8e1 100644
--- a/application/dialogs/CopyInstanceDialog.cpp
+++ b/application/dialogs/CopyInstanceDialog.cpp
@@ -52,6 +52,7 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent)
}
ui->groupBox->setCurrentIndex(index);
ui->groupBox->lineEdit()->setPlaceholderText(tr("No group"));
+ ui->copySavesCheckbox->setChecked(m_copySaves);
}
CopyInstanceDialog::~CopyInstanceDialog()
@@ -95,3 +96,20 @@ void CopyInstanceDialog::on_instNameTextBox_textChanged(const QString &arg1)
{
updateDialogState();
}
+
+bool CopyInstanceDialog::shouldCopySaves() const
+{
+ return m_copySaves;
+}
+
+void CopyInstanceDialog::on_copySavesCheckbox_stateChanged(int state)
+{
+ if(state == Qt::Unchecked)
+ {
+ m_copySaves = false;
+ }
+ else if(state == Qt::Checked)
+ {
+ m_copySaves = true;
+ }
+}
diff --git a/application/dialogs/CopyInstanceDialog.h b/application/dialogs/CopyInstanceDialog.h
index faa20615..a519443f 100644
--- a/application/dialogs/CopyInstanceDialog.h
+++ b/application/dialogs/CopyInstanceDialog.h
@@ -39,14 +39,17 @@ public:
QString instName() const;
QString instGroup() const;
QString iconKey() const;
+ bool shouldCopySaves() const;
private
slots:
void on_iconButton_clicked();
void on_instNameTextBox_textChanged(const QString &arg1);
+ void on_copySavesCheckbox_stateChanged(int state);
private:
Ui::CopyInstanceDialog *ui;
QString InstIconKey;
InstancePtr m_original;
+ bool m_copySaves = true;
};
diff --git a/application/dialogs/CopyInstanceDialog.ui b/application/dialogs/CopyInstanceDialog.ui
index 2615168c..bbb1bbb3 100644
--- a/application/dialogs/CopyInstanceDialog.ui
+++ b/application/dialogs/CopyInstanceDialog.ui
@@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>345</width>
- <height>205</height>
+ <height>240</height>
</rect>
</property>
<property name="windowTitle">
@@ -87,7 +87,7 @@
<item row="0" column="0">
<widget class="QLabel" name="labelVersion_3">
<property name="text">
- <string>Group</string>
+ <string>&amp;Group</string>
</property>
<property name="buddy">
<cstring>groupBox</cstring>
@@ -110,6 +110,13 @@
</layout>
</item>
<item>
+ <widget class="QCheckBox" name="copySavesCheckbox">
+ <property name="text">
+ <string>Copy saves</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/application/dialogs/ExportInstanceDialog.cpp b/application/dialogs/ExportInstanceDialog.cpp
index ec46b6ba..8d320a3c 100644
--- a/application/dialogs/ExportInstanceDialog.cpp
+++ b/application/dialogs/ExportInstanceDialog.cpp
@@ -17,7 +17,6 @@
#include "ui_ExportInstanceDialog.h"
#include <BaseInstance.h>
#include <MMCZip.h>
-#include <pathutils.h>
#include <QFileDialog>
#include <QMessageBox>
#include <qfilesystemmodel.h>
@@ -185,7 +184,7 @@ public:
blocked.remove(cover);
// block all contents, except for any cover
QModelIndex rootIndex =
- fsm->index(PathCombine(m_instance->instanceRoot(), cover));
+ fsm->index(FS::PathCombine(m_instance->instanceRoot(), cover));
QModelIndex doing = rootIndex;
int row = 0;
QStack<QModelIndex> todo;
@@ -376,18 +375,18 @@ void SaveIcon(InstancePtr m_instance)
}
}
auto pixmap = icon.pixmap(largest);
- pixmap.save(PathCombine(m_instance->instanceRoot(), iconKey + ".png"));
+ pixmap.save(FS::PathCombine(m_instance->instanceRoot(), iconKey + ".png"));
}
}
}
bool ExportInstanceDialog::doExport()
{
- auto name = RemoveInvalidFilenameChars(m_instance->name());
+ auto name = FS::RemoveInvalidFilenameChars(m_instance->name());
const QString output = QFileDialog::getSaveFileName(
this, tr("Export %1").arg(m_instance->name()),
- PathCombine(QDir::homePath(), name + ".zip"), "Zip (*.zip)");
+ FS::PathCombine(QDir::homePath(), name + ".zip"), "Zip (*.zip)");
if (output.isNull())
{
return false;
@@ -452,7 +451,7 @@ void ExportInstanceDialog::rowsInserted(QModelIndex parent, int top, int bottom)
QString ExportInstanceDialog::ignoreFileName()
{
- return PathCombine(m_instance->instanceRoot(), ".packignore");
+ return FS::PathCombine(m_instance->instanceRoot(), ".packignore");
}
void ExportInstanceDialog::loadPackIgnore()
diff --git a/application/dialogs/VersionSelectDialog.cpp b/application/dialogs/VersionSelectDialog.cpp
index df72189b..50b543db 100644
--- a/application/dialogs/VersionSelectDialog.cpp
+++ b/application/dialogs/VersionSelectDialog.cpp
@@ -24,7 +24,6 @@
#include <BaseVersion.h>
#include <BaseVersionList.h>
#include <tasks/Task.h>
-#include <modutils.h>
#include <QDebug>
#include "MultiMC.h"
#include <VersionProxyModel.h>
diff --git a/application/pages/InstanceSettingsPage.cpp b/application/pages/InstanceSettingsPage.cpp
index 35cbefe5..a23d7c22 100644
--- a/application/pages/InstanceSettingsPage.cpp
+++ b/application/pages/InstanceSettingsPage.cpp
@@ -10,7 +10,7 @@
#include "MultiMC.h"
#include <java/JavaVersionList.h>
-#include <pathutils.h>
+#include <FileSystem.h>
InstanceSettingsPage::InstanceSettingsPage(BaseInstance *inst, QWidget *parent)
: QWidget(parent), ui(new Ui::InstanceSettingsPage), m_instance(inst)
@@ -186,7 +186,7 @@ void InstanceSettingsPage::on_javaDetectBtn_clicked()
void InstanceSettingsPage::on_javaBrowseBtn_clicked()
{
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- QString cooked_path = NormalizePath(raw_path);
+ QString cooked_path = FS::NormalizePath(raw_path);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if(cooked_path.isEmpty())
diff --git a/application/pages/LegacyJarModPage.cpp b/application/pages/LegacyJarModPage.cpp
index 87a9f3b5..5d397978 100644
--- a/application/pages/LegacyJarModPage.cpp
+++ b/application/pages/LegacyJarModPage.cpp
@@ -19,14 +19,13 @@
#include <QKeyEvent>
#include <QKeyEvent>
-#include <pathutils.h>
-
#include "dialogs/VersionSelectDialog.h"
#include "dialogs/ProgressDialog.h"
#include "dialogs/ModEditDialogCommon.h"
#include "minecraft/ModList.h"
#include "minecraft/LegacyInstance.h"
#include "Env.h"
+#include <FileSystem.h>
#include "MultiMC.h"
#include <GuiUtil.h>
@@ -147,7 +146,7 @@ void LegacyJarModPage::on_rmJarBtn_clicked()
void LegacyJarModPage::on_viewJarBtn_clicked()
{
- openDirInDefaultProgram(m_inst->jarModsDir(), true);
+ FS::openDirInDefaultProgram(m_inst->jarModsDir(), true);
}
void LegacyJarModPage::jarCurrent(QModelIndex current, QModelIndex previous)
diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp
index 9a2a43a4..e3ece5a6 100644
--- a/application/pages/ModFolderPage.cpp
+++ b/application/pages/ModFolderPage.cpp
@@ -22,8 +22,6 @@
#include <QDesktopServices>
#include <QAbstractItemModel>
-#include <pathutils.h>
-
#include "MultiMC.h"
#include "dialogs/CustomMessageBox.h"
#include "dialogs/ModEditDialogCommon.h"
@@ -31,6 +29,7 @@
#include "minecraft/ModList.h"
#include "minecraft/Mod.h"
#include "minecraft/VersionFilterData.h"
+#include <FileSystem.h>
ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr<ModList> mods, QString id,
QString iconName, QString displayName, QString helpPage,
@@ -163,7 +162,7 @@ void ModFolderPage::on_rmModBtn_clicked()
void ModFolderPage::on_viewModBtn_clicked()
{
- openDirInDefaultProgram(m_mods->dir().absolutePath(), true);
+ FS::openDirInDefaultProgram(m_mods->dir().absolutePath(), true);
}
void ModFolderPage::modCurrent(const QModelIndex &current, const QModelIndex &previous)
diff --git a/application/pages/OtherLogsPage.cpp b/application/pages/OtherLogsPage.cpp
index f1b59f1e..799f4f39 100644
--- a/application/pages/OtherLogsPage.cpp
+++ b/application/pages/OtherLogsPage.cpp
@@ -21,7 +21,7 @@
#include "GuiUtil.h"
#include "RecursiveFileSystemWatcher.h"
#include <GZip.h>
-#include <pathutils.h>
+#include <FileSystem.h>
OtherLogsPage::OtherLogsPage(QString path, IPathMatcher::Ptr fileFilter, QWidget *parent)
: QWidget(parent), ui(new Ui::OtherLogsPage), m_path(path), m_fileFilter(fileFilter),
@@ -83,7 +83,7 @@ void OtherLogsPage::on_selectLogBox_currentIndexChanged(const int index)
file = ui->selectLogBox->itemText(index);
}
- if (file.isEmpty() || !QFile::exists(PathCombine(m_path, file)))
+ if (file.isEmpty() || !QFile::exists(FS::PathCombine(m_path, file)))
{
m_currentFile = QString();
ui->text->clear();
@@ -104,7 +104,7 @@ void OtherLogsPage::on_btnReload_clicked()
setControlsEnabled(false);
return;
}
- QFile file(PathCombine(m_path, m_currentFile));
+ QFile file(FS::PathCombine(m_path, m_currentFile));
if (!file.open(QFile::ReadOnly))
{
setControlsEnabled(false);
@@ -174,7 +174,7 @@ void OtherLogsPage::on_btnDelete_clicked()
{
return;
}
- QFile file(PathCombine(m_path, m_currentFile));
+ QFile file(FS::PathCombine(m_path, m_currentFile));
if (!file.remove())
{
QMessageBox::critical(this, tr("Error"), tr("Unable to delete %1: %2")
@@ -215,7 +215,7 @@ void OtherLogsPage::on_btnClean_clicked()
QStringList failed;
for(auto item: toDelete)
{
- QFile file(PathCombine(m_path, item));
+ QFile file(FS::PathCombine(m_path, item));
if (!file.remove())
{
failed.push_back(item);
diff --git a/application/pages/ScreenshotsPage.cpp b/application/pages/ScreenshotsPage.cpp
index 2a8d7a43..5f5d11f7 100644
--- a/application/pages/ScreenshotsPage.cpp
+++ b/application/pages/ScreenshotsPage.cpp
@@ -15,7 +15,6 @@
#include <QDesktopServices>
#include <QKeyEvent>
-#include <pathutils.h>
#include <MultiMC.h>
#include "dialogs/ProgressDialog.h"
@@ -26,6 +25,7 @@
#include "tasks/SequentialTask.h"
#include "RWStorage.h"
+#include <FileSystem.h>
typedef RWStorage<QString, QIcon> SharedIconCache;
typedef std::shared_ptr<SharedIconCache> SharedIconCachePtr;
@@ -219,7 +219,7 @@ ScreenshotsPage::ScreenshotsPage(QString path, QWidget *parent)
m_model->setNameFilters({"*.png"});
m_model->setNameFilterDisables(false);
m_folder = path;
- m_valid = ensureFolderPathExists(m_folder);
+ m_valid = FS::ensureFolderPathExists(m_folder);
ui->setupUi(this);
ui->tabWidget->tabBar()->hide();
@@ -271,12 +271,12 @@ void ScreenshotsPage::onItemActivated(QModelIndex index)
return;
auto info = m_model->fileInfo(index);
QString fileName = info.absoluteFilePath();
- openFileInDefaultProgram(info.absoluteFilePath());
+ FS::openFileInDefaultProgram(info.absoluteFilePath());
}
void ScreenshotsPage::on_viewFolderBtn_clicked()
{
- openDirInDefaultProgram(m_folder, true);
+ FS::openDirInDefaultProgram(m_folder, true);
}
void ScreenshotsPage::on_uploadBtn_clicked()
diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp
index e6933da7..e1abcf0c 100644
--- a/application/pages/VersionPage.cpp
+++ b/application/pages/VersionPage.cpp
@@ -15,7 +15,6 @@
#include "MultiMC.h"
-#include <pathutils.h>
#include <QMessageBox>
#include <QEvent>
#include <QKeyEvent>
diff --git a/application/pages/WorldListPage.cpp b/application/pages/WorldListPage.cpp
index 6bea9dbd..4e7eeedc 100644
--- a/application/pages/WorldListPage.cpp
+++ b/application/pages/WorldListPage.cpp
@@ -16,6 +16,7 @@
#include "WorldListPage.h"
#include "ui_WorldListPage.h"
#include "minecraft/WorldList.h"
+#include <FileSystem.h>
#include "dialogs/ModEditDialogCommon.h"
#include <QEvent>
#include <QKeyEvent>
@@ -122,7 +123,7 @@ void WorldListPage::on_rmWorldBtn_clicked()
void WorldListPage::on_viewFolderBtn_clicked()
{
- openDirInDefaultProgram(m_worlds->dir().absolutePath(), true);
+ FS::openDirInDefaultProgram(m_worlds->dir().absolutePath(), true);
}
QModelIndex WorldListPage::getSelectedWorld()
diff --git a/application/pages/WorldListPage.h b/application/pages/WorldListPage.h
index 1ef441a6..7a7cf591 100644
--- a/application/pages/WorldListPage.h
+++ b/application/pages/WorldListPage.h
@@ -20,7 +20,6 @@
#include "minecraft/OneSixInstance.h"
#include "BasePage.h"
#include <MultiMC.h>
-#include <pathutils.h>
class WorldList;
namespace Ui
diff --git a/application/pages/global/ExternalToolsPage.cpp b/application/pages/global/ExternalToolsPage.cpp
index 26b2f31e..e8091dee 100644
--- a/application/pages/global/ExternalToolsPage.cpp
+++ b/application/pages/global/ExternalToolsPage.cpp
@@ -20,10 +20,9 @@
#include <QFileDialog>
#include <QStandardPaths>
-#include <pathutils.h>
-
#include "settings/SettingsObject.h"
#include "tools/BaseProfiler.h"
+#include <FileSystem.h>
#include "MultiMC.h"
ExternalToolsPage::ExternalToolsPage(QWidget *parent) :
@@ -91,7 +90,7 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked()
{
break;
}
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
if (!MMC->profilers()["jprofiler"]->check(cooked_dir, &error))
{
QMessageBox::critical(this, tr("Error"),
@@ -130,7 +129,7 @@ void ExternalToolsPage::on_jvisualvmPathBtn_clicked()
{
break;
}
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
if (!MMC->profilers()["jvisualvm"]->check(cooked_dir, &error))
{
QMessageBox::critical(this, tr("Error"),
@@ -174,7 +173,7 @@ void ExternalToolsPage::on_mceditPathBtn_clicked()
{
break;
}
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
if (!MMC->tools()["mcedit"]->check(cooked_dir, &error))
{
QMessageBox::critical(this, tr("Error"),
@@ -213,7 +212,7 @@ void ExternalToolsPage::on_jsonEditorBrowseBtn_clicked()
? QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation).first()
#endif
: ui->jsonEditorTextBox->text());
- QString cooked_file = NormalizePath(raw_file);
+ QString cooked_file = FS::NormalizePath(raw_file);
if (cooked_file.isEmpty())
{
diff --git a/application/pages/global/JavaPage.cpp b/application/pages/global/JavaPage.cpp
index 18882ad9..1c33a9ff 100644
--- a/application/pages/global/JavaPage.cpp
+++ b/application/pages/global/JavaPage.cpp
@@ -21,8 +21,6 @@
#include <QMessageBox>
#include <QDir>
-#include <pathutils.h>
-
#include "dialogs/VersionSelectDialog.h"
#include <ColumnResizer.h>
@@ -30,6 +28,7 @@
#include "java/JavaVersionList.h"
#include "settings/SettingsObject.h"
+#include <FileSystem.h>
#include "MultiMC.h"
JavaPage::JavaPage(QWidget *parent) : QWidget(parent), ui(new Ui::JavaPage)
@@ -109,7 +108,7 @@ void JavaPage::on_javaDetectBtn_clicked()
void JavaPage::on_javaBrowseBtn_clicked()
{
QString raw_path = QFileDialog::getOpenFileName(this, tr("Find Java executable"));
- QString cooked_path = NormalizePath(raw_path);
+ QString cooked_path = FS::NormalizePath(raw_path);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if(cooked_path.isEmpty())
diff --git a/application/pages/global/MinecraftPage.cpp b/application/pages/global/MinecraftPage.cpp
index 3e05924e..3f1e4388 100644
--- a/application/pages/global/MinecraftPage.cpp
+++ b/application/pages/global/MinecraftPage.cpp
@@ -19,8 +19,6 @@
#include <QMessageBox>
#include <QDir>
-#include <pathutils.h>
-
#include "settings/SettingsObject.h"
#include "MultiMC.h"
diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp
index 6a8730c7..5b7a1204 100644
--- a/application/pages/global/MultiMCPage.cpp
+++ b/application/pages/global/MultiMCPage.cpp
@@ -21,11 +21,11 @@
#include <QDir>
#include <QTextCharFormat>
-#include <pathutils.h>
#include <ColumnResizer.h>
#include "updater/UpdateChecker.h"
#include "settings/SettingsObject.h"
+#include <FileSystem.h>
#include "MultiMC.h"
// FIXME: possibly move elsewhere
@@ -85,7 +85,7 @@ void MultiMCPage::on_ftbLauncherBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"),
ui->ftbLauncherBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
@@ -97,7 +97,7 @@ void MultiMCPage::on_ftbBrowseBtn_clicked()
{
QString raw_dir =
QFileDialog::getExistingDirectory(this, tr("FTB Directory"), ui->ftbBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
@@ -110,12 +110,12 @@ void MultiMCPage::on_instDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"),
ui->instDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
{
- if (checkProblemticPathJava(QDir(cooked_dir)))
+ if (FS::checkProblemticPathJava(QDir(cooked_dir)))
{
QMessageBox warning;
warning.setText(tr("You're trying to specify an instance folder which\'s path "
@@ -143,7 +143,7 @@ void MultiMCPage::on_iconsDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"),
ui->iconsDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
@@ -155,7 +155,7 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"),
ui->modsDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
@@ -167,7 +167,7 @@ void MultiMCPage::on_lwjglDirBrowseBtn_clicked()
{
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"),
ui->lwjglDirTextBox->text());
- QString cooked_dir = NormalizePath(raw_dir);
+ QString cooked_dir = FS::NormalizePath(raw_dir);
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
@@ -308,8 +308,8 @@ void MultiMCPage::applySettings()
// FTB
s->set("TrackFTBInstances", ui->trackFtbBox->isChecked());
- s->set("FTBLauncherLocal", NormalizePath(ui->ftbLauncherBox->text()));
- s->set("FTBRoot", NormalizePath(ui->ftbBox->text()));
+ s->set("FTBLauncherLocal", FS::NormalizePath(ui->ftbLauncherBox->text()));
+ s->set("FTBRoot", FS::NormalizePath(ui->ftbBox->text()));
// Folders
// TODO: Offer to move instances to new instance folder.
diff --git a/application/pages/global/PasteEEPage.cpp b/application/pages/global/PasteEEPage.cpp
index e6827601..15ceafe0 100644
--- a/application/pages/global/PasteEEPage.cpp
+++ b/application/pages/global/PasteEEPage.cpp
@@ -20,8 +20,6 @@
#include <QFileDialog>
#include <QStandardPaths>
-#include <pathutils.h>
-
#include "settings/SettingsObject.h"
#include "tools/BaseProfiler.h"
#include "MultiMC.h"