fixed show in Finder/Explorer (aka open containing folder)

This commit is contained in:
Luis Ángel San Martín 2013-06-26 11:07:03 +02:00
parent c701d5a979
commit 5f58a1cba2

View File

@ -1405,10 +1405,33 @@ void LibraryWindow::asignNumbers()
void LibraryWindow::openContainingFolderComic() void LibraryWindow::openContainingFolderComic()
{ {
QModelIndex modelIndex = comicView->currentIndex(); QModelIndex modelIndex = comicView->currentIndex();
QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex)); QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex));
#ifdef Q_OS_LINUX
QString path = file.absolutePath(); QString path = file.absolutePath();
QDesktopServices::openUrl(QUrl("file:///"+path, QUrl::TolerantMode)); QDesktopServices::openUrl(QUrl("file:///"+path, QUrl::TolerantMode));
#endif
#ifdef Q_WS_MAC
QString filePath = file.absoluteFilePath();
QStringList args;
args << "-e";
args << "tell application \"Finder\"";
args << "-e";
args << "activate";
args << "-e";
args << "select POSIX file \""+filePath+"\"";
args << "-e";
args << "end tell";
QProcess::startDetached("osascript", args);
#endif
#ifdef Q_WS_WIN
QString filePath = file.absoluteFilePath();
QStringList args;
args << "/select," << QDir::toNativeSeparators(filePath);
QProcess::startDetached("explorer", args);
#endif
} }
void LibraryWindow::openContainingFolder() void LibraryWindow::openContainingFolder()