1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Use SetFile/GetFileInfo from bundle

This commit is contained in:
Leo Franchi
2012-02-26 10:57:00 -05:00
parent a8440c72e4
commit 56c2f86381
3 changed files with 12 additions and 3 deletions

View File

@@ -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)

View File

@@ -22,6 +22,7 @@
#include "utils/logger.h"
#include "tomahawksettings.h"
#include <QCoreApplication>
#include <QProcess>
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;
}

View File

@@ -51,6 +51,8 @@ private:
QHash<QPersistentModelIndex, Qt::CheckState> m_checkTable;
bool m_shownVolumes;
QString m_setFilePath;
QString m_getFileInfoPath;
};