1 // Copyright (c) 2012 Dennco Project
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 // Created by tkawata on Oct-1, 2012.
24 #include <QFileInfoList>
27 void DCUtil::removeDirRecursive(QString path)
29 if (path.isEmpty() || path.length() == 0)
34 QFileInfoList list = dir.entryInfoList(QDir::NoDot | QDir::NoDotDot | QDir::AllEntries);
36 for (int i = 0; i < list.length(); i++)
38 QFileInfo info = list.at(i);
41 removeDirRecursive(info.absoluteFilePath());
45 QFile file(info.absoluteFilePath());
53 QString DCUtil::getFQNPath(const QString& containerBasedPath, const QString& name)
55 return QString::fromStdString(getFQNString(containerBasedPath.toLocal8Bit().data(), name.toLocal8Bit().data()));
59 QString DCUtil::getFQNPath(std::string containerBasedPath, std::string name)
61 return QString::fromStdString(getFQNString(containerBasedPath.c_str(), name.c_str()));
65 QString DCUtil::getNameFromFQNPath(const QString& fqnString)
67 if (fqnString.indexOf("#") >= 0)
68 return fqnString.mid(fqnString.indexOf("#")+1);
74 QString DCUtil::getContainerBasedPathFromFQNPath(const QString& fqnPath)
76 if (fqnPath.indexOf("#") >= 0)
77 return fqnPath.left(fqnPath.indexOf("#"));