From 56c2f863815a72a9b328feac118188e14ba151b8 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Sun, 26 Feb 2012 10:57:00 -0500 Subject: [PATCH] Use SetFile/GetFileInfo from bundle --- src/CMakeLists.osx.cmake | 3 +++ src/libtomahawk/widgets/checkdirtree.cpp | 10 +++++++--- src/libtomahawk/widgets/checkdirtree.h | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.osx.cmake b/src/CMakeLists.osx.cmake index 9239931eb..f7a502f47 100644 --- a/src/CMakeLists.osx.cmake +++ b/src/CMakeLists.osx.cmake @@ -58,4 +58,7 @@ if (APPLE) FILE(COPY ${CMAKE_SOURCE_DIR}/admin/mac/sparkle_pub.pem DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/Resources") + FILE(COPY /usr/bin/SetFile DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/MacOS") + FILE(COPY /usr/bin/GetFileInfo DESTINATION "${CMAKE_BINARY_DIR}/tomahawk.app/Contents/MacOS") + endif (APPLE) diff --git a/src/libtomahawk/widgets/checkdirtree.cpp b/src/libtomahawk/widgets/checkdirtree.cpp index ee4bdc86f..b5d1e4a7a 100644 --- a/src/libtomahawk/widgets/checkdirtree.cpp +++ b/src/libtomahawk/widgets/checkdirtree.cpp @@ -22,6 +22,7 @@ #include "utils/logger.h" #include "tomahawksettings.h" +#include #include static QString s_macVolumePath = "/Volumes"; @@ -31,9 +32,12 @@ CheckDirModel::CheckDirModel( QWidget* parent ) , m_shownVolumes( false ) { #ifdef Q_WS_MAC + m_setFilePath = QString( "%1/SetFile" ) .arg( QCoreApplication::applicationDirPath() ); + m_getFileInfoPath = QString( "%1/GetFileInfo" ).arg( QCoreApplication::applicationDirPath() ); + QProcess* checkVolumeVisible = new QProcess( this ); connect( checkVolumeVisible, SIGNAL( readyReadStandardOutput() ), this, SLOT( getFileInfoResult() ) ); - checkVolumeVisible->start( "GetFileInfo", QStringList() << "-aV" << s_macVolumePath ); + checkVolumeVisible->start( m_getFileInfoPath, QStringList() << "-aV" << s_macVolumePath ); #endif } @@ -42,7 +46,7 @@ CheckDirModel::~CheckDirModel() #ifdef Q_WS_MAC // reset to previous state if ( m_shownVolumes ) - QProcess::startDetached( QString( "SetFile -a V %1" ).arg( s_macVolumePath ) ); + QProcess::startDetached( QString( "%1 -a V %2" ).arg( m_setFilePath).arg( s_macVolumePath ) ); #endif } @@ -60,7 +64,7 @@ CheckDirModel::getFileInfoResult() // Remove the hidden flag for the /Volumnes folder so all mount points are visible in the default (Q)FileSystemModel QProcess* p = new QProcess( this ); connect( p, SIGNAL( finished( int, QProcess::ExitStatus ) ), this, SLOT( volumeShowFinished() ) ); - p->start( QString( "SetFile -a v %1" ).arg( s_macVolumePath ) ); + p->start( QString( "%1 -a v %2" ).arg( m_setFilePath ).arg( s_macVolumePath ) ); m_shownVolumes = true; } diff --git a/src/libtomahawk/widgets/checkdirtree.h b/src/libtomahawk/widgets/checkdirtree.h index 3c8119534..f064a5c0d 100644 --- a/src/libtomahawk/widgets/checkdirtree.h +++ b/src/libtomahawk/widgets/checkdirtree.h @@ -51,6 +51,8 @@ private: QHash m_checkTable; bool m_shownVolumes; + QString m_setFilePath; + QString m_getFileInfoPath; };