static inline bool AddToPathEnv (csString dir, csString& pathEnv) { // check if installdir is in the path. bool gotpath = false; size_t dlen = dir.Length(); // csGetInstallDir() might return "" (current dir) if (dlen != 0) { ToLower (dir); if (!pathEnv.IsEmpty()) { csString mypath (pathEnv); ToLower (mypath); const char* ppos = strstr (mypath.GetData(), dir); while (!gotpath && ppos) { const char* npos = strchr (ppos, ';'); size_t len = npos ? npos - ppos : strlen (ppos); if ((len == dlen) || (len == dlen+1)) { if (ppos[len] == '\\') len--; if (!strncmp (ppos, dir, len)) { // found it gotpath = true; } } ppos = npos ? strstr (npos+1, dir) : 0; } } if (!gotpath) { // put CRYSTAL path into PATH environment. csString newpath; newpath.Append (dir); newpath.Append (";"); newpath.Append (pathEnv); pathEnv = newpath; return true; } } return false; }
bool TextWriter::writeCommon(const Metric& metric) { std::ostringstream path; for (uint32_t i=0; i<_path.size(); ++i) { path << _path[i] << "."; } std::string mypath(path.str()); path << metric.getMangledName(); if (_regex.match(path.str())) { if (metric.used() || _verbose) { _out << "\n" << mypath; return true; } } return false; }