mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 20:20:02 +00:00
oshelper: always convert to canonical path in openContainingFolder
This commit is contained in:
parent
7eeda0a8f0
commit
6898d5dd42
1 changed files with 5 additions and 4 deletions
|
@ -92,22 +92,23 @@ QString OSHelper::downloadLocation() const
|
||||||
|
|
||||||
bool OSHelper::openContainingFolder(const QString &filePath) const
|
bool OSHelper::openContainingFolder(const QString &filePath) const
|
||||||
{
|
{
|
||||||
|
QString canonicalFilePath = QFileInfo(filePath).canonicalFilePath();
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
if (openFolderAndSelectItem(QDir::toNativeSeparators(filePath)))
|
if (openFolderAndSelectItem(QDir::toNativeSeparators(canonicalFilePath)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_MAC)
|
#elif defined(Q_OS_MAC)
|
||||||
if (MacOSHelper::openFolderAndSelectItem(QUrl::fromLocalFile(filePath)))
|
if (MacOSHelper::openFolderAndSelectItem(QUrl::fromLocalFile(canonicalFilePath)))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QUrl url = QUrl::fromLocalFile(QFileInfo(filePath).absolutePath());
|
QUrl url = QUrl::fromLocalFile(canonicalFilePath);
|
||||||
if (!url.isValid())
|
if (!url.isValid())
|
||||||
{
|
{
|
||||||
qWarning() << "Malformed file path" << filePath << url.errorString();
|
qWarning() << "Malformed file path" << canonicalFilePath << url.errorString();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return QDesktopServices::openUrl(url);
|
return QDesktopServices::openUrl(url);
|
||||||
|
|
Loading…
Reference in a new issue