MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / checkInstancePathForProblems

Method checkInstancePathForProblems

launcher/ui/MainWindow.cpp:2316–2353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2314}
2315
2316void MainWindow::checkInstancePathForProblems()
2317{
2318 QString instanceFolder = APPLICATION->settings()->get("InstanceDir").toString();
2319 if (FS::checkProblemticPathJava(QDir(instanceFolder)))
2320 {
2321 QMessageBox warning(this);
2322 warning.setText(tr("Your instance folder contains \'!\' and this is known to cause Java problems!"));
2323 warning.setInformativeText(
2324 tr(
2325 "You have now two options: <br/>"
2326 " - change the instance folder in the settings <br/>"
2327 " - move this installation of %1 to a different folder"
2328 ).arg(BuildConfig.LAUNCHER_NAME)
2329 );
2330 warning.setDefaultButton(QMessageBox::Ok);
2331 warning.exec();
2332 }
2333 auto tempFolderText = tr("This is a problem: <br/>"
2334 " - The launcher will likely be deleted without warning by the operating system <br/>"
2335 " - close the launcher now and extract it to a real location, not a temporary folder");
2336 QString pathfoldername = QDir(instanceFolder).absolutePath();
2337 if (pathfoldername.contains("Rar$", Qt::CaseInsensitive))
2338 {
2339 QMessageBox warning(this);
2340 warning.setText(tr("Your instance folder contains \'Rar$\' - that means you haven't extracted the launcher archive!"));
2341 warning.setInformativeText(tempFolderText);
2342 warning.setDefaultButton(QMessageBox::Ok);
2343 warning.exec();
2344 }
2345 else if (pathfoldername.startsWith(QDir::tempPath()) || pathfoldername.contains("/TempState/"))
2346 {
2347 QMessageBox warning(this);
2348 warning.setText(tr("Your instance folder is in a temporary folder: \'%1\'!").arg(QDir::tempPath()));
2349 warning.setInformativeText(tempFolderText);
2350 warning.setDefaultButton(QMessageBox::Ok);
2351 warning.exec();
2352 }
2353}
2354
2355void MainWindow::updateStatusCenter()
2356{

Callers 1

showMainWindowMethod · 0.80

Calls 8

checkProblemticPathJavaFunction · 0.85
QDirClass · 0.50
toStringMethod · 0.45
getMethod · 0.45
settingsMethod · 0.45
setTextMethod · 0.45
execMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected