TFilePathSet TMyPaintBrushStyle::getBrushesDirs() { TFilePathSet paths; paths.push_back(m_libraryDir + "mypaint brushes"); QStringList genericLocations = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); for(QStringList::iterator i = genericLocations.begin(); i != genericLocations.end(); ++i) paths.push_back(TFilePath(*i) + "mypaint" + "brushes"); return paths; }
TFilePathSet TEnv::getSystemVarPathSetValue(std::string varName) { TFilePathSet lst; std::string value = EnvGlobals::instance()->getSystemVarValue(varName); int len = (int)value.size(); int i = 0; int j = value.find(';'); while (j != std::string::npos) { std::string s = value.substr(i, j - i); lst.push_back(TFilePath(s)); i = j + 1; if (i >= len) return lst; j = value.find(';', i); } if (i < len) lst.push_back(TFilePath(value.substr(i))); return lst; }
TFilePathSet TSystem::getDisks() { TFilePathSet filePathSet; QFileInfoList fil = QDir::drives(); int i; for (i = 0; i < fil.size(); i++) filePathSet.push_back(TFilePath(fil.at(i).filePath().toStdWString())); return filePathSet; }
TFilePathSet TEnv::getSystemVarPathSetValue(std::string varName) { TFilePathSet lst; EnvGlobals *eg = EnvGlobals::instance(); // if the path is registered by command line argument, then use it std::string value = eg->getArgPathValue(varName); if (value == "") value = eg->getSystemVarValue(varName); int len = (int)value.size(); int i = 0; int j = value.find(';'); while (j != std::string::npos) { std::string s = value.substr(i, j - i); lst.push_back(TFilePath(s)); i = j + 1; if (i >= len) return lst; j = value.find(';', i); } if (i < len) lst.push_back(TFilePath(value.substr(i))); return lst; }
void TSystem::readDirectoryTree(TFilePathSet &dst, const TFilePath &path, bool groupFrames, bool onlyFiles) { if (!TFileStatus(path).isDirectory()) throw TSystemException(path, " is not a directory"); QFileInfoList fil = QDir(toQString(path)).entryInfoList(); int i; for (i = 0; i < fil.size(); i++) { QFileInfo fi = fil.at(i); if (fi.fileName() == QString(".") || fi.fileName() == QString("..")) continue; TFilePath son = TFilePath(fi.filePath().toStdWString()); if (TFileStatus(son).isDirectory()) { if (!onlyFiles) dst.push_back(son); readDirectoryTree(dst, son, groupFrames, onlyFiles); } else dst.push_back(son); } }