mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-02 05:30:23 +02:00
Enhancement - Path, File, Directory integration
- Replaced all access calls. - Replaced all stat calls. - Obsoleted util.cpp isAbsoluteDirectory calls. - Obsoleted util.cpp expandPath calls.
This commit is contained in:
parent
8e47342a18
commit
b596e96b43
9 changed files with 66 additions and 120 deletions
|
@ -33,6 +33,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include "Directory.h"
|
||||
#include "Date.h"
|
||||
#include "Duration.h"
|
||||
#include "text.h"
|
||||
|
@ -521,13 +522,13 @@ static void parseTask (Task& task, const std::string& after)
|
|||
void editFile (Task& task)
|
||||
{
|
||||
// Check for file permissions.
|
||||
std::string dataLocation = expandPath (context.config.get ("data.location"));
|
||||
if (access (dataLocation.c_str (), X_OK))
|
||||
Directory location (context.config.get ("data.location"));
|
||||
if (! location.writable ())
|
||||
throw std::string ("Your data.location directory is not writable.");
|
||||
|
||||
// Create a temp file name in data.location.
|
||||
std::stringstream file;
|
||||
file << dataLocation << "/task." << getpid () << "." << task.id << ".task";
|
||||
file << location.data << "/task." << getpid () << "." << task.id << ".task";
|
||||
|
||||
// Format the contents, T -> text, write to a file.
|
||||
std::string before = formatTask (task);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue