mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-07 22:58:34 +02:00
Code Cleanup
- Cmake was not updating HAVE_ST_BIRTHTIME. - NIBBLER_FEATURE_DATE was not properly applied everywhere. - FEATURE_COLOR was not properly set. - Some source files failed to include cmake.h, and therefore were not properly - Removed inefficient use of std::string::substr for guaranteed single character strings. - Integrated Directory::cd. - Integrated File::ctime, ::btime. - Integrated Path::operator+. - Integrated Nibbler::getDigit{2,4,6}. - Integrated HighResTimer. enabling/disabling code. - All Path objects now expanded internally to absolute form. - Modified unit tests to accomodate absolute paths. - Merged new nibbler.t.cpp tests. - Made various methods const. - Includes removed from some files, added to others.
This commit is contained in:
parent
ebaf09cbe0
commit
a1132f0028
24 changed files with 254 additions and 39 deletions
27
src/File.cpp
27
src/File.cpp
|
@ -32,6 +32,7 @@
|
|||
#include <unistd.h>
|
||||
#include <File.h>
|
||||
#include <text.h>
|
||||
#include <cmake.h>
|
||||
#include <util.h>
|
||||
#include <i18n.h>
|
||||
|
||||
|
@ -101,7 +102,7 @@ bool File::create ()
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool File::remove ()
|
||||
bool File::remove () const
|
||||
{
|
||||
return unlink (_data.c_str ()) == 0 ? true : false;
|
||||
}
|
||||
|
@ -335,6 +336,30 @@ time_t File::mtime () const
|
|||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
time_t File::ctime () const
|
||||
{
|
||||
struct stat s;
|
||||
if (!stat (_data.c_str (), &s))
|
||||
return s.st_ctime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
time_t File::btime () const
|
||||
{
|
||||
struct stat s;
|
||||
if (!stat (_data.c_str (), &s))
|
||||
#ifdef HAVE_ST_BIRTHTIME
|
||||
return s.st_birthtime;
|
||||
#else
|
||||
return s.st_ctime;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool File::create (const std::string& name)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue