diff --git a/CHANGES b/CHANGES index 14a83d267..2c048bc92 100644 --- a/CHANGES +++ b/CHANGES @@ -42,6 +42,7 @@ Misc: - Libretro: Disable logging game errors, BIOS calls and stubs in release builds - ARM7: Support forcing Thumb mode via MSR - ARM7: Flush prefetch cache when loading CPSR via MSR + - Qt: Canonicalize file paths when loading games 0.4.0: (2016-02-02) Features: diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index b724ea09c..f55403b23 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -288,14 +288,12 @@ void GameController::setDebugger(mDebugger* debugger) { void GameController::loadGame(const QString& path) { closeGame(); - QFile file(path); - if (!file.open(QIODevice::ReadOnly)) { + QFileInfo info(path); + if (!info.isReadable()) { LOG(QT, ERROR) << tr("Failed to open game file: %1").arg(path); return; } - file.close(); - - m_fname = path; + m_fname = info.canonicalFilePath(); openGame(); } @@ -406,7 +404,12 @@ void GameController::replaceGame(const QString& path) { return; } - m_fname = path; + QFileInfo info(path); + if (!info.isReadable()) { + LOG(QT, ERROR) << tr("Failed to open game file: %1").arg(path); + return; + } + m_fname = info.canonicalFilePath(); threadInterrupt(); mCoreLoadFile(m_threadContext.core, m_fname.toLocal8Bit().constData()); threadContinue(); diff --git a/src/platform/qt/Window.cpp b/src/platform/qt/Window.cpp index 93a23b6ea..dcef253bd 100644 --- a/src/platform/qt/Window.cpp +++ b/src/platform/qt/Window.cpp @@ -333,11 +333,12 @@ void Window::multiplayerChanged() { void Window::selectBIOS() { QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS")); if (!filename.isEmpty()) { - m_config->setOption("bios", filename); + QFileInfo info(filename); + m_config->setOption("bios", info.canonicalFilePath()); m_config->updateOption("bios"); m_config->setOption("useBios", true); m_config->updateOption("useBios"); - m_controller->loadBIOS(filename); + m_controller->loadBIOS(info.canonicalFilePath()); } }