- Fixed bug #257 where an extant ~/.taskrc file prevented the override and
  automatic creation of an alternate rc file (thanks to Zach Frazier).
This commit is contained in:
Paul Beckingham 2009-08-07 16:11:09 -06:00
parent 1355571876
commit a7196ca181
2 changed files with 22 additions and 8 deletions

View file

@ -20,6 +20,8 @@
+ Fixed bug #252 that prevented use of attribute modifiers on dates to effect + Fixed bug #252 that prevented use of attribute modifiers on dates to effect
a range, such as "task ls due.after:eom due.before:eoy" (thanks to John a range, such as "task ls due.after:eom due.before:eoy" (thanks to John
Florian). Florian).
+ Fixed bug #257 where an extant ~/.taskrc file prevented the override and
automatic creation of an alternate rc file (thanks to Zach Frazier).
------ old releases ------------------------------ ------ old releases ------------------------------

View file

@ -339,6 +339,14 @@ void Context::loadCorrectConfigFile ()
else if (arg->substr (0, 3) == "rc:") else if (arg->substr (0, 3) == "rc:")
{ {
rc = arg->substr (3, std::string::npos); rc = arg->substr (3, std::string::npos);
home = rc;
std::string::size_type last_slash = rc.rfind ("/");
if (last_slash != std::string::npos)
home = rc.substr (0, last_slash);
else
home = ".";
args.erase (arg); args.erase (arg);
header ("Using alternate .taskrc file " + rc); // TODO i18n header ("Using alternate .taskrc file " + rc); // TODO i18n
break; break;
@ -367,15 +375,19 @@ void Context::loadCorrectConfigFile ()
} }
// Do we need to create a default rc? // Do we need to create a default rc?
if (access (rc.c_str (), F_OK) && if (access (rc.c_str (), F_OK))
confirm ("A configuration file could not be found in " // TODO i18n
+ home
+ "\n\n"
+ "Would you like a sample "
+ rc
+ " created, so task can proceed?"))
{ {
config.createDefaultRC (rc, data); if (confirm ("A configuration file could not be found in " // TODO i18n
+ home
+ "\n\n"
+ "Would you like a sample "
+ rc
+ " created, so task can proceed?"))
{
config.createDefaultRC (rc, data);
}
else
throw std::string ("Cannot proceed without rc file.");
} }
// Create data location, if necessary. // Create data location, if necessary.