NOISSUE fix log-related legacy instance crash and show hidden log files
This commit is contained in:
		| @@ -56,12 +56,11 @@ public: | ||||
| 			values.append(new NotesPage(legacy.get())); | ||||
| 			values.append(new ScreenshotsPage(PathCombine(legacy->minecraftRoot(), "screenshots"))); | ||||
| 			values.append(new InstanceSettingsPage(legacy.get())); | ||||
| 			values.append(new OtherLogsPage(legacy->minecraftRoot(), inst->getLogFileMatcher())); | ||||
| 		} | ||||
| 		auto logMatcher = inst->getLogFileMatcher(); | ||||
| 		if(logMatcher) | ||||
| 		{ | ||||
| 			values.append(new OtherLogsPage(onesix->minecraftRoot(), logMatcher)); | ||||
| 			values.append(new OtherLogsPage(inst->getLogFileRoot(), logMatcher)); | ||||
| 		} | ||||
| 		return values; | ||||
| 	} | ||||
|   | ||||
| @@ -169,6 +169,11 @@ public: | ||||
| 	 */ | ||||
| 	virtual IPathMatcher::Ptr getLogFileMatcher() = 0; | ||||
|  | ||||
| 	/*! | ||||
| 	 * Returns the root folder to use for looking up log files | ||||
| 	 */ | ||||
| 	virtual QString getLogFileRoot() = 0; | ||||
|  | ||||
| 	/*! | ||||
| 	 * does any necessary cleanups after the instance finishes. also runs before\ | ||||
| 	 * TODO: turn into a task that can run asynchronously | ||||
|   | ||||
| @@ -74,4 +74,8 @@ public: | ||||
| 	{ | ||||
| 		return nullptr; | ||||
| 	} | ||||
| 	virtual QString getLogFileRoot() | ||||
| 	{ | ||||
| 		return instanceRoot(); | ||||
| 	} | ||||
| }; | ||||
|   | ||||
| @@ -86,11 +86,11 @@ QStringList RecursiveFileSystemWatcher::scanRecursive(const QDir &directory) | ||||
| 	{ | ||||
| 		return {}; | ||||
| 	} | ||||
| 	for (const QString &dir : directory.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) | ||||
| 	for (const QString &dir : directory.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::Hidden)) | ||||
| 	{ | ||||
| 		ret.append(scanRecursive(directory.absoluteFilePath(dir))); | ||||
| 	} | ||||
| 	for (const QString &file : directory.entryList(QDir::Files)) | ||||
| 	for (const QString &file : directory.entryList(QDir::Files | QDir::Hidden)) | ||||
| 	{ | ||||
| 		auto relPath = m_root.relativeFilePath(directory.absoluteFilePath(file)); | ||||
| 		if (m_matcher->matches(relPath)) | ||||
|   | ||||
| @@ -284,7 +284,14 @@ IPathMatcher::Ptr MinecraftInstance::getLogFileMatcher() | ||||
| 	auto combined = std::make_shared<MultiMatcher>(); | ||||
| 	combined->add(std::make_shared<RegexpMatcher>(".*\\.log(\\.[0-9]*)?(\\.gz)?$")); | ||||
| 	combined->add(std::make_shared<RegexpMatcher>("crash-.*\\.txt")); | ||||
| 	combined->add(std::make_shared<RegexpMatcher>("IDMap dump.*\\.txt$")); | ||||
| 	combined->add(std::make_shared<RegexpMatcher>("ModLoader\\.txt(\\..*)?$")); | ||||
| 	return combined; | ||||
| } | ||||
|  | ||||
| QString MinecraftInstance::getLogFileRoot() | ||||
| { | ||||
| 	return minecraftRoot(); | ||||
| } | ||||
|  | ||||
| #include "MinecraftInstance.moc" | ||||
|   | ||||
| @@ -46,6 +46,8 @@ public: | ||||
|  | ||||
| 	virtual IPathMatcher::Ptr getLogFileMatcher() override; | ||||
|  | ||||
| 	virtual QString getLogFileRoot() override; | ||||
|  | ||||
| protected: | ||||
| 	QMap<QString, QString> createCensorFilterFromSession(AuthSessionPtr session); | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user