mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-12-27 21:15:19 +00:00
GH-1065 Normalize usage of directory vs folder
This commit is contained in:
parent
944ff256b2
commit
98e17998fe
@ -15,7 +15,7 @@ void ensureExists(const QDir &dir)
|
||||
{
|
||||
if (!QDir().mkpath(dir.absolutePath()))
|
||||
{
|
||||
throw FileSystemException("Unable to create directory " + dir.dirName() + " (" +
|
||||
throw FileSystemException("Unable to create folder " + dir.dirName() + " (" +
|
||||
dir.absolutePath() + ")");
|
||||
}
|
||||
}
|
||||
@ -265,7 +265,7 @@ QString ResolveExecutable(QString path)
|
||||
/**
|
||||
* Normalize path
|
||||
*
|
||||
* Any paths inside the current directory will be normalized to relative paths (to current)
|
||||
* Any paths inside the current folder will be normalized to relative paths (to current)
|
||||
* Other paths will be made absolute
|
||||
*/
|
||||
QString NormalizePath(QString path)
|
||||
@ -324,7 +324,7 @@ QString DirNameFromString(QString string, QString inDir)
|
||||
return dirName;
|
||||
}
|
||||
|
||||
// Does the directory path contain any '!'? If yes, return true, otherwise false.
|
||||
// Does the folder path contain any '!'? If yes, return true, otherwise false.
|
||||
// (This is a problem for Java)
|
||||
bool checkProblemticPathJava(QDir folder)
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
// --dir
|
||||
parser.addOption("dir", applicationDirPath());
|
||||
parser.addShortOpt("dir", 'd');
|
||||
parser.addDocumentation("dir", "use the supplied directory as MultiMC root instead of "
|
||||
parser.addDocumentation("dir", "use the supplied folder as MultiMC root instead of "
|
||||
"the binary location (use '.' for current)");
|
||||
// --launch
|
||||
parser.addOption("launch");
|
||||
@ -188,7 +188,7 @@ MultiMC::MultiMC(int &argc, char **argv) : QApplication(argc, argv)
|
||||
QString binPath = applicationDirPath();
|
||||
QString adjustedBy;
|
||||
QString dataPath;
|
||||
// change directory
|
||||
// change folder
|
||||
QString dirParam = args["dir"].toString();
|
||||
if (!dirParam.isEmpty())
|
||||
{
|
||||
|
@ -11,16 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -29,7 +20,7 @@
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="minecraftTab">
|
||||
<attribute name="title">
|
||||
@ -413,7 +404,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCustomCmdsDescription">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Pre-launch command runs before the instance launches and post-exit command runs after it exits.</p><p>Both will be run in MultiMC's working directory with extra environment variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_NAME - Name of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_ID - ID of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_DIR - absolute path of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_MC_DIR - absolute path of minecraft</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA - java binary used for launch</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA_ARGS - command-line parameters used for launch</li></ul></body></html></string>
|
||||
<string><html><head/><body><p>Pre-launch command runs before the instance launches and post-exit command runs after it exits.</p><p>Both will be run in MultiMC's working folder with extra environment variables:</p><ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_NAME - Name of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_ID - ID of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_DIR - absolute path of the instance</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_MC_DIR - absolute path of minecraft</li><li style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA - java binary used for launch</li><li style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">INST_JAVA_ARGS - command-line parameters used for launch</li></ul></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
|
@ -86,7 +86,7 @@ void ExternalToolsPage::on_jprofilerPathBtn_clicked()
|
||||
QString error;
|
||||
do
|
||||
{
|
||||
raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Directory"), raw_dir);
|
||||
raw_dir = QFileDialog::getExistingDirectory(this, tr("JProfiler Folder"), raw_dir);
|
||||
if (raw_dir.isEmpty())
|
||||
{
|
||||
break;
|
||||
@ -164,7 +164,7 @@ void ExternalToolsPage::on_mceditPathBtn_clicked()
|
||||
#warning stuff
|
||||
raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Application"), raw_dir);
|
||||
#else
|
||||
raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Directory"), raw_dir);
|
||||
raw_dir = QFileDialog::getExistingDirectory(this, tr("MCEdit Folder"), raw_dir);
|
||||
#endif
|
||||
if (raw_dir.isEmpty())
|
||||
{
|
||||
|
@ -17,16 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -273,7 +264,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Pre-launch command runs before the instance launches and post-exit command runs after it exits. Both will be run in MultiMC's working directory with INST_ID, INST_DIR, and INST_NAME as environment variables.</p><p>Wrapper command allows running java using an extra wrapper program (like 'optirun' on Linux)</p></body></html></string>
|
||||
<string><html><head/><body><p>Pre-launch command runs before the instance launches and post-exit command runs after it exits. Both will be run in MultiMC's working folder with INST_ID, INST_DIR, and INST_NAME as environment variables.</p><p>Wrapper command allows running java using an extra wrapper program (like 'optirun' on Linux)</p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
|
@ -99,7 +99,7 @@ bool MultiMCPage::apply()
|
||||
|
||||
void MultiMCPage::on_ftbLauncherBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Directory"),
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("FTB Launcher Folder"),
|
||||
ui->ftbLauncherBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
@ -112,7 +112,7 @@ void MultiMCPage::on_ftbLauncherBrowseBtn_clicked()
|
||||
void MultiMCPage::on_ftbBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir =
|
||||
QFileDialog::getExistingDirectory(this, tr("FTB Directory"), ui->ftbBox->text());
|
||||
QFileDialog::getExistingDirectory(this, tr("FTB Folder"), ui->ftbBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
|
||||
@ -124,7 +124,7 @@ void MultiMCPage::on_ftbBrowseBtn_clicked()
|
||||
|
||||
void MultiMCPage::on_instDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Directory"),
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Instance Folder"),
|
||||
ui->instDirTextBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
@ -157,7 +157,7 @@ void MultiMCPage::on_instDirBrowseBtn_clicked()
|
||||
|
||||
void MultiMCPage::on_iconsDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Directory"),
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Icons Folder"),
|
||||
ui->iconsDirTextBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
@ -169,7 +169,7 @@ void MultiMCPage::on_iconsDirBrowseBtn_clicked()
|
||||
}
|
||||
void MultiMCPage::on_modsDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Directory"),
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("Mods Folder"),
|
||||
ui->modsDirTextBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
@ -181,7 +181,7 @@ void MultiMCPage::on_modsDirBrowseBtn_clicked()
|
||||
}
|
||||
void MultiMCPage::on_lwjglDirBrowseBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Directory"),
|
||||
QString raw_dir = QFileDialog::getExistingDirectory(this, tr("LWJGL Folder"),
|
||||
ui->lwjglDirTextBox->text());
|
||||
QString cooked_dir = FS::NormalizePath(raw_dir);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user