Add default config generation
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include "Common.h"
|
||||
#include "Utils.h"
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <cstring>
|
||||
#include <dirent.h>
|
||||
#include <fstream>
|
||||
@@ -10,6 +11,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
|
||||
struct FileUtils
|
||||
{
|
||||
@@ -28,6 +30,20 @@ struct FileUtils
|
||||
return mkdir(path.c_str(), 0777);
|
||||
}
|
||||
|
||||
static std::string GetCurrentDirectory()
|
||||
{
|
||||
static char path[256]; // Usual maximum filename
|
||||
getcwd(path, sizeof(path));
|
||||
std::string dir = path;
|
||||
size_t pos = dir.find_last_of("/");
|
||||
if(pos == std::string::npos)
|
||||
{
|
||||
LOG_ERROR("Couldn't find / (slash) in directory. This shouldn't occur.");
|
||||
assert(false);
|
||||
}
|
||||
return dir.substr(pos+1);
|
||||
}
|
||||
|
||||
static std::string GetRealPath(const std::string& filename)
|
||||
{
|
||||
#if defined(__linux__)
|
||||
|
||||
Reference in New Issue
Block a user