NOISSUE dissolve util library
This commit is contained in:
@ -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)
|
||||
|
@ -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();
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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>&Group</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>groupBox</cstring>
|
||||
@ -109,6 +109,13 @@
|
||||
</item>
|
||||
</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">
|
||||
|
@ -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()
|
||||
|
@ -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>
|
||||
|
@ -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())
|
||||
|
@ -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)
|
||||
|
@ -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 ¤t, const QModelIndex &previous)
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "MultiMC.h"
|
||||
|
||||
#include <pathutils.h>
|
||||
#include <QMessageBox>
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
|
@ -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()
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "minecraft/OneSixInstance.h"
|
||||
#include "BasePage.h"
|
||||
#include <MultiMC.h>
|
||||
#include <pathutils.h>
|
||||
|
||||
class WorldList;
|
||||
namespace Ui
|
||||
|
@ -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())
|
||||
{
|
||||
|
@ -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())
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
||||
#include <pathutils.h>
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "MultiMC.h"
|
||||
|
||||
|
@ -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.
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include <QFileDialog>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <pathutils.h>
|
||||
|
||||
#include "settings/SettingsObject.h"
|
||||
#include "tools/BaseProfiler.h"
|
||||
#include "MultiMC.h"
|
||||
|
Reference in New Issue
Block a user