mirror of
https://github.com/antopilo/Nuake.git
synced 2026-09-04 11:35:06 +03:00
Now stores recent.json in config folder
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "FileSystem.h"
|
||||
|
||||
#include "Engine.h"
|
||||
#include "OS.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
@@ -197,6 +198,17 @@ namespace Nuake
|
||||
return std::filesystem::remove_all(path.c_str());
|
||||
}
|
||||
|
||||
std::string FileSystem::GetConfigFolderPath()
|
||||
{
|
||||
std::string subFolderPath = OS::GetConfigFolderPath().append("/Nuake/");
|
||||
if (!DirectoryExists(subFolderPath))
|
||||
{
|
||||
MakeDirectory(subFolderPath);
|
||||
}
|
||||
|
||||
return subFolderPath;
|
||||
}
|
||||
|
||||
Ref<Directory> FileSystem::GetFileTree()
|
||||
{
|
||||
return RootDirectory;
|
||||
|
||||
@@ -50,6 +50,7 @@ namespace Nuake
|
||||
static void EndWriteFile();
|
||||
static uintmax_t DeleteFileFromPath(const std::string& path);
|
||||
static uintmax_t DeleteFolder(const std::string& path);
|
||||
static std::string GetConfigFolderPath();
|
||||
};
|
||||
|
||||
enum class FileType
|
||||
|
||||
@@ -3,9 +3,19 @@
|
||||
#include "Engine.h"
|
||||
|
||||
#ifdef NK_WIN
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
|
||||
#include <Windows.h>
|
||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||
#include <Windows.h>
|
||||
#include <ShlObj.h>
|
||||
#include <string.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef NK_LINUX
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "GLFW/glfw3.h"
|
||||
@@ -92,6 +102,37 @@ namespace Nuake {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string OS::GetConfigFolderPath()
|
||||
{
|
||||
std::string path;
|
||||
|
||||
#ifdef NK_WIN
|
||||
TCHAR appDataPath[64];
|
||||
// Get the path to the AppData folder
|
||||
if (SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, appDataPath) >= 0)
|
||||
{
|
||||
std::wstring wideString(appDataPath);
|
||||
path = std::string(wideString.begin(), wideString.end());
|
||||
// Now, 'appDataPath' contains the path to the AppData folder
|
||||
path.erase(std::remove_if(path.begin(), path.end(), [](char c)
|
||||
{
|
||||
return c == '\0';
|
||||
}), path.end());
|
||||
std::replace(path.begin(), path.end(), '\\', '/');
|
||||
}
|
||||
else
|
||||
{
|
||||
path = "";
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef NK_LINUX
|
||||
path = "~/.config/";
|
||||
#endif
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void OS::OpenURL(const std::string& url)
|
||||
{
|
||||
#ifdef NK_WIN
|
||||
|
||||
@@ -17,5 +17,6 @@ namespace Nuake
|
||||
static void ShowInFileExplorer(const std::string& filePath);
|
||||
static void OpenTrenchbroomMap(const std::string& filePath);
|
||||
static void OpenURL(const std::string& url);
|
||||
static std::string GetConfigFolderPath();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -23,7 +23,10 @@ namespace Nuake
|
||||
{
|
||||
BEGIN_SERIALIZE();
|
||||
SERIALIZE_VAL(ModelPath);
|
||||
SERIALIZE_OBJECT(ModelResource);
|
||||
if (ModelResource)
|
||||
{
|
||||
SERIALIZE_OBJECT(ModelResource);
|
||||
}
|
||||
END_SERIALIZE();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user