mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-24 08:56:43 +02:00
Bug #642
- 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:
parent
b6c28ecb7a
commit
aca76da3e5
7 changed files with 20 additions and 20 deletions
|
@ -31,12 +31,10 @@
|
|||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <inttypes.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
#include <Directory.h>
|
||||
#include <Date.h>
|
||||
#include <File.h>
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
@ -579,18 +578,8 @@ const std::vector <std::string> Context::getCommands () const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
void Context::assumeLocations ()
|
||||
{
|
||||
// Note that this pointer is deliberately not free()'d, even though valgrind
|
||||
// complains about it. It is either not necessary, or forbidden, depending
|
||||
// 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");
|
||||
rc_file = File ("~/.taskrc");
|
||||
data_dir = Directory ("~/.task");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -603,14 +592,14 @@ void Context::createDefaultConfig ()
|
|||
!confirm (format (STRING_CONTEXT_CREATE_RC, home_dir, rc_file._data)))
|
||||
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.
|
||||
config.createDefaultData (data_dir);
|
||||
|
||||
// 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 ())
|
||||
extension_dir.create ();
|
||||
*/
|
||||
|
|
11
src/Path.cpp
11
src/Path.cpp
|
@ -53,12 +53,16 @@ Path::Path ()
|
|||
Path::Path (const Path& other)
|
||||
{
|
||||
if (this != &other)
|
||||
_data = other._data;
|
||||
{
|
||||
_original = other._original;
|
||||
_data = other._data;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
Path::Path (const std::string& in)
|
||||
{
|
||||
_original = in;
|
||||
_data = expand (in);
|
||||
}
|
||||
|
||||
|
@ -71,7 +75,10 @@ Path::~Path ()
|
|||
Path& Path::operator= (const Path& other)
|
||||
{
|
||||
if (this != &other)
|
||||
this->_data = other._data;
|
||||
{
|
||||
this->_original = other._original;
|
||||
this->_data = other._data;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -61,6 +61,7 @@ public:
|
|||
static std::vector<std::string> glob (const std::string&);
|
||||
|
||||
public:
|
||||
std::string _original;
|
||||
std::string _data;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue