本文整理汇总了C++中TFilePath::isLevelName方法的典型用法代码示例。如果您正苦于以下问题:C++ TFilePath::isLevelName方法的具体用法?C++ TFilePath::isLevelName怎么用?C++ TFilePath::isLevelName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TFilePath
的用法示例。
在下文中一共展示了TFilePath::isLevelName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renameFileOrLevel_throw
void TSystem::renameFileOrLevel_throw(const TFilePath &dst,
const TFilePath &src,
bool renamePalette) {
if (renamePalette && ((src.getType() == "tlv") || (src.getType() == "tzp") ||
(src.getType() == "tzu"))) {
// Special case: since renames cannot be 'grouped' in the UI, palettes are
// automatically
// renamed here if required
const char *type = (src.getType() == "tlv") ? "tpl" : "plt";
TFilePath srcpltname(src.withNoFrame().withType(type));
TFilePath dstpltname(dst.withNoFrame().withType(type));
if (TSystem::doesExistFileOrLevel(src) &&
TSystem::doesExistFileOrLevel(srcpltname))
TSystem::renameFile(dstpltname, srcpltname, false);
}
if (src.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(src.getParentDir(), false);
for (TFilePathSet::iterator it = files.begin(); it != files.end(); it++) {
if (it->getLevelName() == src.getLevelName()) {
TFilePath src1 = *it;
TFilePath dst1 = dst.withFrame(it->getFrame());
TSystem::renameFile(dst1, src1);
}
}
} else
TSystem::renameFile(dst, src);
}
示例2: doesExistFileOrLevel
bool TSystem::doesExistFileOrLevel(const TFilePath &fp) {
if (TFileStatus(fp).doesExist()) return true;
if (fp.isLevelName()) {
const TFilePath &parentDir = fp.getParentDir();
if (!TFileStatus(parentDir).doesExist()) return false;
TFilePathSet files;
try {
files = TSystem::readDirectory(parentDir, false, true, true);
} catch (...) {
}
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == fp.getLevelNameW()) return true;
}
} else if (fp.getType() == "psd") {
QString name(QString::fromStdWString(fp.getWideName()));
name.append(QString::fromStdString(fp.getDottedType()));
int sepPos = name.indexOf("#");
int dotPos = name.indexOf(".", sepPos);
int removeChars = dotPos - sepPos;
int doubleUnderscorePos = name.indexOf("__", sepPos);
if (doubleUnderscorePos > 0) removeChars = doubleUnderscorePos - sepPos;
name.remove(sepPos, removeChars);
TFilePath psdpath(fp.getParentDir() + TFilePath(name.toStdWString()));
if (TFileStatus(psdpath).doesExist()) return true;
}
return false;
}
示例3: hideFileOrLevel_throw
void TSystem::hideFileOrLevel_throw(const TFilePath &fp) {
if (fp.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(fp.getParentDir(), false);
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == fp.getLevelNameW()) TSystem::hideFile(*it);
}
} else
TSystem::hideFile(fp);
}
示例4: copyFileOrLevel_throw
void TSystem::copyFileOrLevel_throw(const TFilePath &dst,
const TFilePath &src) {
if (src.isLevelName()) {
TFilePathSet files;
files = TSystem::readDirectory(src.getParentDir(), false);
TFilePathSet::iterator it, end = files.end();
for (it = files.begin(); it != end; ++it) {
if (it->getLevelNameW() == src.getLevelNameW()) {
TFilePath src1 = *it;
TFilePath dst1 = dst.withFrame(it->getFrame());
TSystem::copyFile(dst1, src1);
}
}
} else
TSystem::copyFile(dst, src);
}