mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 08:34:52 -07:00
Merge pull request #116 from ctrlaltca/feature-cpack
Use cpack to create osx's dmg
This commit is contained in:
commit
65f59747c9
10 changed files with 141 additions and 101 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#include "settingscache.h"
|
||||
#include <QSettings>
|
||||
#include <QDir>
|
||||
|
||||
SettingsCache::SettingsCache()
|
||||
{
|
||||
|
|
@ -257,3 +258,31 @@ void SettingsCache::setMainWindowGeometry(const QByteArray &_mainWindowGeometry)
|
|||
mainWindowGeometry = _mainWindowGeometry;
|
||||
settings->setValue("interface/main_window_geometry", mainWindowGeometry);
|
||||
}
|
||||
|
||||
void SettingsCache::copyPath(const QString &src, const QString &dst)
|
||||
{
|
||||
// test source && return if inexistent
|
||||
QDir dir(src);
|
||||
if (! dir.exists())
|
||||
return;
|
||||
// test destination && create if inexistent
|
||||
QDir tmpDir(dst);
|
||||
if (!tmpDir.exists())
|
||||
{
|
||||
tmpDir.setPath(QDir::rootPath());
|
||||
if (!tmpDir.mkdir(dst) && !tmpDir.exists()) {
|
||||
// TODO: this is probably not good.
|
||||
qDebug() << "copyPath(): Failed to create dir: " << dst;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
|
||||
QString dst_path = dst + QDir::separator() + d;
|
||||
dir.mkpath(dst_path);
|
||||
copyPath(src+ QDir::separator() + d, dst_path);
|
||||
}
|
||||
|
||||
foreach (QString f, dir.entryList(QDir::Files)) {
|
||||
QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue