diff --git a/ChangeLog b/ChangeLog index f00310160..ff81c1245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,8 @@ + 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 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 ------------------------------ diff --git a/src/Context.cpp b/src/Context.cpp index fbd8bd73a..abb22239c 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -339,6 +339,14 @@ void Context::loadCorrectConfigFile () else if (arg->substr (0, 3) == "rc:") { 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); header ("Using alternate .taskrc file " + rc); // TODO i18n break; @@ -367,15 +375,19 @@ void Context::loadCorrectConfigFile () } // Do we need to create a default rc? - 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?")) + if (access (rc.c_str (), F_OK)) { - 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.