|
@@ -1,4 +1,4 @@
|
|
-#include "src/astandardpaths.h"
|
|
|
|
|
|
+#include "src/classes/astandardpaths.h"
|
|
|
|
|
|
//QMap<QStandardPaths::StandardLocation, QString> AStandardPaths::paths;
|
|
//QMap<QStandardPaths::StandardLocation, QString> AStandardPaths::paths;
|
|
QMap<AStandardPaths::Dirs, QString> AStandardPaths::paths;
|
|
QMap<AStandardPaths::Dirs, QString> AStandardPaths::paths;
|
|
@@ -7,27 +7,28 @@ void AStandardPaths::setup()
|
|
{
|
|
{
|
|
auto settings_location = QStandardPaths::AppConfigLocation;
|
|
auto settings_location = QStandardPaths::AppConfigLocation;
|
|
auto data_location = QStandardPaths::AppDataLocation;
|
|
auto data_location = QStandardPaths::AppDataLocation;
|
|
- paths = {
|
|
|
|
|
|
+ paths = { // [G]: potential rename to `dirs`
|
|
{Database, QStandardPaths::writableLocation(data_location)},
|
|
{Database, QStandardPaths::writableLocation(data_location)},
|
|
{Templates, QDir(QStandardPaths::writableLocation(data_location)).filePath("templates")},
|
|
{Templates, QDir(QStandardPaths::writableLocation(data_location)).filePath("templates")},
|
|
{Settings, QStandardPaths::writableLocation(settings_location)},
|
|
{Settings, QStandardPaths::writableLocation(settings_location)},
|
|
|
|
+ {DatabaseBackup, QDir(QStandardPaths::writableLocation(data_location)).filePath("backup")}
|
|
};
|
|
};
|
|
DEB << "Paths created: " << paths;
|
|
DEB << "Paths created: " << paths;
|
|
}
|
|
}
|
|
|
|
|
|
-QString AStandardPaths::getPath(Dirs loc)
|
|
|
|
|
|
+QString AStandardPaths::pathTo(Dirs loc)
|
|
{
|
|
{
|
|
return paths[loc];
|
|
return paths[loc];
|
|
}
|
|
}
|
|
|
|
|
|
-QMap<AStandardPaths::Dirs, QString> AStandardPaths::getPaths()
|
|
|
|
|
|
+QMap<AStandardPaths::Dirs, QString> AStandardPaths::allPaths()
|
|
{
|
|
{
|
|
return paths;
|
|
return paths;
|
|
}
|
|
}
|
|
|
|
|
|
void AStandardPaths::scan_paths()
|
|
void AStandardPaths::scan_paths()
|
|
{
|
|
{
|
|
- for(auto& path : paths.values()){
|
|
|
|
|
|
+ for(auto& path : paths){
|
|
auto dir = QDir(path);
|
|
auto dir = QDir(path);
|
|
DEB << "Scanning " << dir.path();
|
|
DEB << "Scanning " << dir.path();
|
|
if(!dir.exists()) {
|
|
if(!dir.exists()) {
|
|
@@ -39,7 +40,7 @@ void AStandardPaths::scan_paths()
|
|
|
|
|
|
bool AStandardPaths::validate_paths()
|
|
bool AStandardPaths::validate_paths()
|
|
{
|
|
{
|
|
- for(auto& path : paths.values()){
|
|
|
|
|
|
+ for(auto& path : paths){
|
|
DEB << "Validating " << path;
|
|
DEB << "Validating " << path;
|
|
if(false) // determine path as valid (scan contents and parse for correctness)
|
|
if(false) // determine path as valid (scan contents and parse for correctness)
|
|
return false;
|
|
return false;
|