search and use user's Documents folder on Windows

This commit is contained in:
2018-09-17 22:39:32 +02:00
parent dfc4a956ab
commit 93d31e0374
4 changed files with 24 additions and 7 deletions

View File

@@ -114,10 +114,26 @@ void App::initLog()
//sprintf_s(path, "%s%s", out_drive, out_path);
//data_path = path;
CHAR path[MAX_PATH];
GetCurrentDirectoryA(sizeof(path), path);
data_path = path;
CHAR my_documents[MAX_PATH];
HRESULT result = SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, my_documents);
if (SUCCEEDED(result))
{
std::string path = std::string(my_documents) + "\\PanoPainter";
if (!PathFileExistsA(path.c_str()))
CreateDirectoryA(path.c_str(), NULL);
App::I.data_path = path;
}
else
{
CHAR path[MAX_PATH];
GetCurrentDirectoryA(sizeof(path), path);
data_path = path;
}
rec_path = data_path + "\\frames";
if (!PathFileExistsA(rec_path.c_str()))
CreateDirectoryA(rec_path.c_str(), NULL);
#endif
//LogRemote::I.start();