Enhancement - Path integration

- Implemented Path::operator (std::string) const, to provide an
  automatic cast to std::string for any Path, File or Directory.
- Made use of new cast in various code.
- Changed use of spaces in atoi () calls.
- Switched from std::string::data () to std::string::c_str () calls.
This commit is contained in:
Paul Beckingham 2010-01-16 14:42:36 -05:00
parent a6875ced6e
commit e53ba8110b
9 changed files with 35 additions and 18 deletions

View file

@ -125,7 +125,7 @@ void Context::initialize ()
// init TDB.
tdb.clear ();
std::vector <std::string> all;
split (all, location.data, ',');
split (all, location, ',');
foreach (path, all)
tdb.location (*path);
}
@ -372,7 +372,7 @@ void Context::loadCorrectConfigFile ()
file_override = *arg;
rc = File (arg->substr (3));
home = rc.data;
home = rc;
std::string::size_type last_slash = rc.data.rfind ("/");
if (last_slash != std::string::npos)
home = rc.data.substr (0, last_slash);
@ -388,7 +388,7 @@ void Context::loadCorrectConfigFile ()
// Load rc file.
config.clear (); // Dump current values.
config.setDefaults (); // Add in the custom reports.
config.load (rc.data); // Load new file.
config.load (rc); // Load new file.
if (config.get ("data.location") != "")
data = Directory (config.get ("data.location"));
@ -417,19 +417,19 @@ void Context::loadCorrectConfigFile ()
+ rc.data
+ " created, so task can proceed?"))
{
config.createDefaultRC (rc.data, data.data);
config.createDefaultRC (rc, data);
}
else
throw std::string ("Cannot proceed without rc file.");
}
// Create data location, if necessary.
config.createDefaultData (data.data);
config.createDefaultData (data);
// Load rc file.
config.clear (); // Dump current values.
config.setDefaults (); // Add in the custom reports.
config.load (rc.data); // Load new file.
config.load (rc); // Load new file.
// Apply overrides of type: "rc.name:value", or "rc.name=value".
std::vector <std::string> filtered;