本文整理汇总了C++中WrapperStr::path方法的典型用法代码示例。如果您正苦于以下问题:C++ WrapperStr::path方法的具体用法?C++ WrapperStr::path怎么用?C++ WrapperStr::path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WrapperStr
的用法示例。
在下文中一共展示了WrapperStr::path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file_path
WrapperStr UmlPackage::file_path(const WrapperStr & f)
{
if (!dir.read) {
dir.file = pythonDir();
if (! RootDirRead) {
RootDirRead = TRUE;
RootDir = PythonSettings::rootDir();
if (!RootDir.isEmpty() && // empty -> error
QDir::isRelativePath(RootDir)) {
QFileInfo f(getProject()->supportFile());
QDir d(f.path());
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(WrapperStr("<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 'Python')</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
WrapperStr 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::cleanPath(s) + "/";
index = s.find("/");
int index2;
while ((index2 = s.find("/", index + 1)) != -1) {
WrapperStr s2 = s.left(index2);
QDir sd(s2);
if (!sd.exists()) {
if (!sd.mkdir(s2)) {
UmlCom::trace(WrapperStr("<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 WrapperStr(d.filePath(f).toLatin1().constData()) + WrapperStr(".") +
PythonSettings::sourceExtension();
}