[SCM] Kaboom - Debian KDE 3->4 migration tool branch, master, updated. master/1.1.1-10-g346824e
George Kiagiadakis
gkiagia-guest at alioth.debian.org
Wed Jul 8 11:27:04 UTC 2009
The following commit has been merged in the master branch:
commit ff77e46835b6d6c68c38621aa723d881efb767f2
Author: George Kiagiadakis <kiagiadakis.george at gmail.com>
Date: Wed Jul 8 14:09:58 2009 +0300
Create the stamp's parent directory if it doesn't already exist.
---
kaboomsettings.cpp | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/kaboomsettings.cpp b/kaboomsettings.cpp
index f5b6ea5..72e783b 100644
--- a/kaboomsettings.cpp
+++ b/kaboomsettings.cpp
@@ -1,6 +1,7 @@
/*
Copyright (C) 2009 Modestas Vainius <modestas at vainius.eu>
2009 Sune Vuorela <sune at vuorela.dk>
+ 2009 George Kiagiadakis <gkiagia at users.sourceforge.net>
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@@ -139,8 +140,28 @@ bool KaboomSettings::stampExists() const
void KaboomSettings::touchStamp()
{
+ QDir stampDir(QFileInfo(m_stampFile.fileName()).dir());
+ if ( !stampDir.exists() ) {
+ qDebug() << "Stamp's parent directory does not exist. Creating...";
+ //If the stampDir path is absolute, the QDir object that creates it doesn't matter.
+ //If the stampDir path is relative, it is probably given from the command line, so
+ //it is relative to the current working directory, thus we create it as a child of
+ //QDir::current(), which represents the current working directory.
+ if ( !QDir::current().mkpath(stampDir.path()) ) {
+ qCritical() << "Could not create directory" << QDir::current().filePath(stampDir.path());
+ } else {
+ // ~/.local should always have drwx------ permissions
+ if ( stampDir == QDir(QDir::homePath() + "/.local") ) {
+ QFile::setPermissions(QDir::home().filePath(".local"),
+ QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
+ }
+ }
+ }
+
if (m_stampFile.open(QIODevice::WriteOnly)) {
fsync(m_stampFile.handle());
m_stampFile.close();
+ } else {
+ qCritical() << "Could not create stamp file";
}
}
--
Kaboom - Debian KDE 3->4 migration tool
More information about the pkg-kde-commits
mailing list