mirror of https://github.com/mgba-emu/mgba.git
Qt: Clean up some path canonicalization
This commit is contained in:
parent
2bfd721ea7
commit
03984ce085
1
CHANGES
1
CHANGES
|
@ -30,6 +30,7 @@ Misc:
|
||||||
- All: Allow use of external minizip library
|
- All: Allow use of external minizip library
|
||||||
- GBA Video: Null renderer should return proper register values
|
- GBA Video: Null renderer should return proper register values
|
||||||
- Libretro: Disable logging game errors, BIOS calls and stubs in release builds
|
- Libretro: Disable logging game errors, BIOS calls and stubs in release builds
|
||||||
|
- Qt: Canonicalize file paths when loading games
|
||||||
|
|
||||||
0.4.0: (2016-02-02)
|
0.4.0: (2016-02-02)
|
||||||
Features:
|
Features:
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
@ -282,14 +283,12 @@ void GameController::setDebugger(ARMDebugger* debugger) {
|
||||||
|
|
||||||
void GameController::loadGame(const QString& path) {
|
void GameController::loadGame(const QString& path) {
|
||||||
closeGame();
|
closeGame();
|
||||||
QFile file(path);
|
QFileInfo info(path);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!info.isReadable()) {
|
||||||
postLog(GBA_LOG_ERROR, tr("Failed to open game file: %1").arg(path));
|
postLog(GBA_LOG_ERROR, tr("Failed to open game file: %1").arg(path));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
file.close();
|
m_fname = info.canonicalFilePath();
|
||||||
|
|
||||||
m_fname = path;
|
|
||||||
openGame();
|
openGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +369,12 @@ void GameController::replaceGame(const QString& path) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fname = path;
|
QFileInfo info(path);
|
||||||
|
if (!info.isReadable()) {
|
||||||
|
postLog(GBA_LOG_ERROR, tr("Failed to open game file: %1").arg(path));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_fname = info.canonicalFilePath();
|
||||||
threadInterrupt();
|
threadInterrupt();
|
||||||
m_threadContext.fname = strdup(m_fname.toLocal8Bit().constData());
|
m_threadContext.fname = strdup(m_fname.toLocal8Bit().constData());
|
||||||
GBAThreadReplaceROM(&m_threadContext, m_threadContext.fname);
|
GBAThreadReplaceROM(&m_threadContext, m_threadContext.fname);
|
||||||
|
|
|
@ -323,11 +323,12 @@ void Window::multiplayerChanged() {
|
||||||
void Window::selectBIOS() {
|
void Window::selectBIOS() {
|
||||||
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS"));
|
QString filename = GBAApp::app()->getOpenFileName(this, tr("Select BIOS"));
|
||||||
if (!filename.isEmpty()) {
|
if (!filename.isEmpty()) {
|
||||||
m_config->setOption("bios", filename);
|
QFileInfo info(filename);
|
||||||
|
m_config->setOption("bios", info.canonicalFilePath());
|
||||||
m_config->updateOption("bios");
|
m_config->updateOption("bios");
|
||||||
m_config->setOption("useBios", true);
|
m_config->setOption("useBios", true);
|
||||||
m_config->updateOption("useBios");
|
m_config->updateOption("useBios");
|
||||||
m_controller->loadBIOS(filename);
|
m_controller->loadBIOS(info.canonicalFilePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue