Ignore:
Timestamp:
Apr 29, 2008, 7:04:59 AM (18 years ago)
Author:
Frederik Heber <heber@…>
Children:
2456db
Parents:
36b128
Message:

configname is also stored in config structure, GetDefaultPath by config::configpath replaced

This stores fragment and affiliated files in same dir as the config, regardless of therein contained paths and is safer and makes the tests work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/config.cpp

    r36b128 r7b1cea  
    1717  pseudopotpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    1818  configpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
     19  configname = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
    1920  strcpy(mainname,"pcp");
    2021  strcpy(defaultpath,"not specified");
     
    8889  Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
    8990  Free((void **)&configpath, "config::~config: *configpath");
     91  Free((void **)&configname, "config::~config: *configname");
    9092};
    9193
     
    406408 * \param *filename config file string
    407409 */
    408 void config::RetrieveConfigPath(char *filename)
     410void config::RetrieveConfigPathAndName(char *filename)
    409411{
     412  char *ptr = NULL;
    410413  int last = -1;
    411414  for(int i=0;i<255;i++) {
     
    417420  if (last == -1) { // no path in front, set to local directory.
    418421    strcpy(configpath, "./");
     422    ptr = filename;
    419423  } else {
    420424    strncpy(configpath, filename, last+1);
     425    ptr = &filename[last+1];
    421426    if (last < 254)
    422427      configpath[last+1]='\0';
    423428  }
    424   cout << "Found configpath: " << configpath << ", dir slash was found at " << last << "." << endl;
     429  strcpy(configname, ptr);
     430  cout << "Found configpath: " << configpath << ", dir slash was found at " << last << ", config name is " << configname << "." << endl;
    425431};
    426432
     
    438444    return;
    439445  }
    440   RetrieveConfigPath(filename);
     446  RetrieveConfigPathAndName(filename);
    441447  // ParseParameters
    442448 
     
    669675    return;
    670676  }
    671   RetrieveConfigPath(filename);
     677  RetrieveConfigPathAndName(filename);
    672678  // ParseParameters
    673679 
Note: See TracChangeset for help on using the changeset viewer.