pdfgen/src/pathname.cxx
//constructors of pathname breaks the path name into dirname and basename
constructors of pathname breaks the path name into dirname and basename
constructors of pathname breaks the path name into dirname and basename
pathname::pathname(string& file)
{
  last_off = 0;
  if (file[0] == FWDSLASH || file[0] == BACKSLASH)
	last_off = 1;
  int val = file.find_last_of(DIR_SEP);
  if (val <= 0) {
	dirname = "";
	last_dir = 1;
	if (val == 0)
	  basename.assign(file, last_off, file.length());
	else
	  basename = file;
  }
  else {
    int len = file.length();
	dirname.assign(file, 0, val);
	basename.assign(file, val+1, len-(val+1));
	last_dir = 0;
  }
  val = basename.find_last_of(DOT);
  if (val > 0)
	suffix.assign(basename, val, basename.length());
}
pathname :: pathname ( string & file ) { last_off = 0 ; if ( file [ 0 ] == FWDSLASH || file [ 0 ] == BACKSLASH ) last_off = 1 ; int val = file . find_last_of ( DIR_SEP ) ; if ( val <= 0 ) { dirname = " " ; last_dir = 1 ; if ( val == 0 ) basename . assign ( file , last_off , file . length ( ) ) ; else basename = file ; } else { int len = file . length ( ) ; dirname . assign ( file , 0 , val ) ; basename . assign ( file , val + 1 , len - ( val + 1 ) ) ; last_dir = 0 ; } val = basename . find_last_of ( DOT ) ; if ( val > 0 ) suffix . assign ( basename , val , basename . length ( ) ) ; }
constructors of pathname breaks the path name into dirname and basename
constructors of pathname breaks the path name into dirname and basename
// Look for a "." in name of file for its suffix