Exemple #1
0
bool callGraphDisplay::selectUnSelectFromFullPathName(const pdstring &name, bool selectFlag) {
  // returns true iff found
  const char *str = name.c_str();
  if (str == NULL)
    return false;
  
  return rootPtr->selectUnSelectFromFullPathName(str, selectFlag);
}
Exemple #2
0
pdstring mapped_module::processDirectories(const pdstring &fn) const {
    // This is black magic... assume Todd (I think) knew what
    // he was doing....
	if(fn == "")
		return "";

	if(!strstr(fn.c_str(),"/./") &&
	   !strstr(fn.c_str(),"/../"))
            return fn;

	pdstring ret;
	char suffix[10] = "";
	char prefix[10] = "";
	char* pPath = new char[strlen(fn.c_str())+1];

	strcpy(pPath,fn.c_str());

	if(pPath[0] == '/')
           strcpy(prefix, "/");
	else
           strcpy(prefix, "");

	if(pPath[strlen(pPath)-1] == '/')
           strcpy(suffix, "/");
	else
           strcpy(suffix, "");

	int count = 0;
	char* pPathLocs[1024];
	char* p = strtok(pPath,"/");
	while(p){
		if(!strcmp(p,".")){
			p = strtok(NULL,"/");
			continue;
		}
		else if(!strcmp(p,"..")){
			count--;
			if(((count < 0) && (*prefix != '/')) || 
			   ((count >= 0) && !strcmp(pPathLocs[count],"..")))
			{
				count++;
				pPathLocs[count++] = p;
			}
			if(count < 0) count = 0;
		}
		else
			pPathLocs[count++] = p;

		p = strtok(NULL,"/");
	}

	ret += prefix;
	for(int i=0;i<count;i++){
		ret += pPathLocs[i];
		if(i != (count-1))
			ret += "/";
	}
	ret += suffix;

	delete[] pPath;
	return ret;
}