- Fixed bug #642, so that the default 'data.location=~/.task' preserves the
  '~', leading to more portable .taskrc files (thanks to alparo).
This commit is contained in:
Paul Beckingham
2013-02-10 17:59:33 -05:00
parent b6c28ecb7a
commit aca76da3e5
7 changed files with 20 additions and 20 deletions

View File

@@ -164,3 +164,5 @@ suggestions:
Tim None Tim None
trHD trHD
Benjamin Weber Benjamin Weber
alparo

View File

@@ -37,6 +37,8 @@ Features
+ Added the configuration variable 'print.empty.columns'. + Added the configuration variable 'print.empty.columns'.
Bugs Bugs
+ Fixed bug #642, so that the default 'data.location=~/.task' preserves the
'~', leading to more portable .taskrc files (thanks to alparo).
+ Fixed bug #947, #1031, which kept expanding aliases after the '--' operator + Fixed bug #947, #1031, which kept expanding aliases after the '--' operator
(thanks to Jim B). (thanks to Jim B).
+ Fixed bug #1038, which prints blank lines with bulk changes and when the + Fixed bug #1038, which prints blank lines with bulk changes and when the

3
NEWS
View File

@@ -19,7 +19,8 @@ New commands in taskwarrior 2.2.0
New configuration options in taskwarrior 2.2.0 New configuration options in taskwarrior 2.2.0
- New color rule 'color.uda.<uda-name>'. - New color rule 'color.uda.<uda-name>'.
+ Added the configuration variable 'print.empty.columns'. - Added the configuration variable 'print.empty.columns'.
- Any ~ characters in a default .taskrc file are preserved.
Newly deprecated features in taskwarrior 2.2.0 Newly deprecated features in taskwarrior 2.2.0

View File

@@ -31,12 +31,10 @@
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <inttypes.h> #include <inttypes.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <pwd.h>
#include <Directory.h> #include <Directory.h>
#include <Date.h> #include <Date.h>
#include <File.h> #include <File.h>

View File

@@ -32,7 +32,6 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
#include <pwd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@@ -579,18 +578,8 @@ const std::vector <std::string> Context::getCommands () const
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
void Context::assumeLocations () void Context::assumeLocations ()
{ {
// Note that this pointer is deliberately not free()'d, even though valgrind rc_file = File ("~/.taskrc");
// complains about it. It is either not necessary, or forbidden, depending data_dir = Directory ("~/.task");
// on OS.
// Set up default locations.
struct passwd* pw = getpwuid (getuid ());
if (!pw)
throw std::string (STRING_NO_HOME);
home_dir = pw->pw_dir;
rc_file = File (home_dir + "/.taskrc");
data_dir = Directory (home_dir + "/.task");
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -603,14 +592,14 @@ void Context::createDefaultConfig ()
!confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data))) !confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data)))
throw std::string (STRING_CONTEXT_NEED_RC); throw std::string (STRING_CONTEXT_NEED_RC);
config.createDefaultRC (rc_file, data_dir); config.createDefaultRC (rc_file, data_dir._original);
} }
// Create data location, if necessary. // Create data location, if necessary.
config.createDefaultData (data_dir); config.createDefaultData (data_dir);
// Create extension directory, if necessary. // Create extension directory, if necessary.
/* TODO Enable this when the time is right, say for 2.1 /* TODO Enable this when the time is right, say for 2.4
if (! extension_dir.exists ()) if (! extension_dir.exists ())
extension_dir.create (); extension_dir.create ();
*/ */

View File

@@ -53,12 +53,16 @@ Path::Path ()
Path::Path (const Path& other) Path::Path (const Path& other)
{ {
if (this != &other) if (this != &other)
_data = other._data; {
_original = other._original;
_data = other._data;
}
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
Path::Path (const std::string& in) Path::Path (const std::string& in)
{ {
_original = in;
_data = expand (in); _data = expand (in);
} }
@@ -71,7 +75,10 @@ Path::~Path ()
Path& Path::operator= (const Path& other) Path& Path::operator= (const Path& other)
{ {
if (this != &other) if (this != &other)
this->_data = other._data; {
this->_original = other._original;
this->_data = other._data;
}
return *this; return *this;
} }

View File

@@ -61,6 +61,7 @@ public:
static std::vector<std::string> glob (const std::string&); static std::vector<std::string> glob (const std::string&);
public: public:
std::string _original;
std::string _data; std::string _data;
}; };