From 5f58a1cba2394578719195730651f13438b5fdc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Wed, 26 Jun 2013 11:07:03 +0200 Subject: [PATCH] fixed show in Finder/Explorer (aka open containing folder) --- YACReaderLibrary/library_window.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/YACReaderLibrary/library_window.cpp b/YACReaderLibrary/library_window.cpp index bc2db8dd..8f57481d 100644 --- a/YACReaderLibrary/library_window.cpp +++ b/YACReaderLibrary/library_window.cpp @@ -1405,10 +1405,33 @@ void LibraryWindow::asignNumbers() void LibraryWindow::openContainingFolderComic() { - QModelIndex modelIndex = comicView->currentIndex(); - QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex)); +QModelIndex modelIndex = comicView->currentIndex(); +QFileInfo file = QDir::cleanPath(currentPath() + dmCV->getComicPath(modelIndex)); +#ifdef Q_OS_LINUX QString path = file.absolutePath(); 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()