本文整理汇总了C++中Q3CString::dirPath方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3CString::dirPath方法的具体用法?C++ Q3CString::dirPath怎么用?C++ Q3CString::dirPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3CString
的用法示例。
在下文中一共展示了Q3CString::dirPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: path
Q3CString UmlPackage::path(const Q3CString & f) {
if (!read) {
dir = idlDir();
if (! RootDirRead) {
RootDirRead = TRUE;
RootDir = IdlSettings::rootDir();
if (!RootDir.isEmpty() && // empty -> error
QDir::isRelativePath(RootDir)) {
QFileInfo f(getProject()->supportFile());
QDir d(f.dirPath());
RootDir = d.filePath(RootDir);
}
}
QDir d_root(RootDir);
if (dir.isEmpty())
dir = RootDir;
else if (QDir::isRelativePath(dir))
dir = d_root.filePath(dir);
if (dir.isEmpty()) {
UmlCom::trace(Q3CString("<font color=\"red\"><b><b> The generation directory "
"must be specified for the package<i> ") + name()
+ "</i>, edit the <i> generation settings</i> (tab 'directory') "
"or edit the package (tab 'Idl')</b></font><br>");
UmlCom::bye(n_errors() + 1);
UmlCom::fatal_error("UmlPackage::file_path");
}
if (QDir::isRelativePath(dir)) {
UmlCom::trace(Q3CString("<font color=\"red\"><b><i>")
+ name() + "</i>'s source path <i>(" + dir
+ "</i>) is not absolute, edit the <i> generation settings</i> "
"(tab 'directory'), or edit the package (tab 'Idl')</b></font><br>");
UmlCom::bye(n_errors() + 1);
UmlCom::fatal_error("UmlPackage::file_path");
}
read = TRUE;
}
QDir d(dir);
if (! d.exists())
create_directory(dir); // don't return on error
return Q3CString(d.filePath(f).toAscii().constData()) + Q3CString(".") +
IdlSettings::sourceExtension();
}
示例2: file_path
Q3CString UmlPackage::file_path(const Q3CString & f) {
if (!dir.read) {
dir.file = javaDir();
if (! RootDirRead) {
RootDirRead = TRUE;
RootDir = JavaSettings::rootDir();
if (!RootDir.isEmpty() && // empty -> error
QDir::isRelativePath(RootDir)) {
QFileInfo f(getProject()->supportFile());
QDir d(f.dirPath());
RootDir = d.filePath(RootDir);
}
}
QDir d_root(RootDir);
if (dir.file.isEmpty())
dir.file = RootDir;
else if (QDir::isRelativePath(dir.file))
dir.file = d_root.filePath(dir.file);
if (dir.file.isEmpty()) {
UmlCom::trace(Q3CString("<font color=\"red\"><b><b> The generation directory "
"must be specified for the package<i> ") + name()
+ "</i>, edit the <i> generation settings</i> (tab 'directory') "
"or edit the package (tab 'Java')</b></font><br>");
UmlCom::bye(n_errors() + 1);
UmlCom::fatal_error("UmlPackage::file_path");
}
dir.read = TRUE;
}
QDir d(dir.file);
if (! d.exists()) {
// create directory including the intermediates
Q3CString s = dir.file;
int index = 0;
QChar sep = QDir::separator();
if (sep != '/') {
while ((index = s.find(sep, index)) != -1)
s.replace(index++, 1, "/");
}
s = QDir::cleanDirPath(s) + "/";
index = s.find("/");
int index2;
while ((index2 = s.find("/", index + 1)) != -1) {
Q3CString s2 = s.left(index2);
QDir sd(s2);
if (!sd.exists()) {
if (!sd.mkdir(s2)) {
UmlCom::trace(Q3CString("<font color=\"red\"><b> cannot create directory <i>")
+ s2 + "</i></b></font><br>");
UmlCom::bye(n_errors() + 1);
UmlCom::fatal_error("UmlPackage::file_path");
}
}
index = index2;
}
}
return Q3CString(d.filePath(f).toAscii().constData()) + Q3CString(".") +
JavaSettings::sourceExtension();
}