mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Extensions: Implemented ::initialize
This commit is contained in:
parent
bdc2a8d974
commit
918573b694
2 changed files with 14 additions and 2 deletions
|
@ -26,11 +26,23 @@
|
||||||
|
|
||||||
#include <cmake.h>
|
#include <cmake.h>
|
||||||
#include <Extensions.h>
|
#include <Extensions.h>
|
||||||
|
#include <FS.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void Extensions::initialize ()
|
void Extensions::initialize (const std::string& location)
|
||||||
{
|
{
|
||||||
|
// Scan extension directory.
|
||||||
|
Directory d (location);
|
||||||
|
if (d.is_directory () &&
|
||||||
|
d.readable ())
|
||||||
|
{
|
||||||
|
_scripts = d.list ();
|
||||||
|
std::sort (_scripts.begin (), _scripts.end ());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
throw std::string ("Extension directory not readable: ") + d._data;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Extensions
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Extensions () = default;
|
Extensions () = default;
|
||||||
void initialize ();
|
void initialize (const std::string&);
|
||||||
std::string dump () const;
|
std::string dump () const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue