bool nuiFileTree::isRoot(const nglPath& rPath) { const nglString& pathName = rPath.GetPathName(); return ( rPath.GetParent().GetPathName().IsEmpty() || !rPath.GetPathName().Compare(_T("/")) || !rPath.GetParent().GetPathName().Compare(_T("/Volumes")) || ((pathName.GetLength() == 3) && (pathName[1] == _T(':')) && (pathName[2] == _T('/'))) ); }
nuiFileList::nuiFileList(const nglPath& rPath) : nuiList(nuiVertical), mFileListSink(this) { SetObjectClass(_T("nuiFileList")); nuiLabel* pLabel = new nuiLabel(_T("..")); pLabel->SetProperty(_T("Path"), rPath.GetParent().GetAbsolutePath().GetPathName()); Populate(rPath); mFileListSink.Connect(Activated, &nuiFileList::Selected, this); }
void Generator::DumpIncluder(const nglPath& rootSource, const nglPath& pngSource,const nglPath& codeSource, const nglPath& HincluderPath, const nglPath& CPPincluderPath, nglString& HincluderStr, nglString& CPPincluderStr) { std::list<nglPath> children; std::list<nglPath>::iterator it; pngSource.GetChildren(&children); for (it = children.begin(); it != children.end(); ++it) { nglPath child = *it; if (!child.IsLeaf()) { // recurs. DumpIncluder(rootSource, child, codeSource, HincluderPath, CPPincluderPath, HincluderStr, CPPincluderStr); continue; } if (child.GetExtension().Compare(_T("png"), false)) continue; nglString node = child.GetPathName(); node.DeleteLeft(rootSource.GetPathName().GetLength()+1); node.DeleteRight(nglPath(node).GetExtension().GetLength() +1); nglPath HdestPath = codeSource + nglPath(node); nglPath CPPdestPath = codeSource + nglPath(node); HdestPath = nglPath(HdestPath.GetPathName() + _T(".h")); CPPdestPath = nglPath(CPPdestPath.GetPathName() + _T(".cpp")); HdestPath.MakeRelativeTo(HincluderPath.GetParent()); CPPdestPath.MakeRelativeTo(CPPincluderPath.GetParent()); nglString tmp; tmp.Format(_T("#include \"%ls\"\n"), HdestPath.GetChars()); HincluderStr.Append(tmp); tmp.Format(_T("#include \"%ls\"\n"), CPPdestPath.GetChars()); CPPincluderStr.Append(tmp); } }
bool nglZipPath::Decompose(const nglPath& rPath, std::list<nglPath>& rList) { nglPath parent(rPath.GetParent()); nglString tmp = rPath.GetNodeName(); nglPath node(tmp.IsNull()? nglString::Empty : tmp); if (parent == rPath) return true; rList.push_front(node); return Decompose(parent, rList); return true; }