mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Add function to get home/documents folder
This commit is contained in:
@@ -250,6 +250,7 @@ namespace FileIO
|
||||
{
|
||||
void GetDefaultFiles(const char *logBaseName, string &capture_filename, string &logging_filename,
|
||||
string &target);
|
||||
string GetHomeFolderFilename();
|
||||
string GetAppFolderFilename(const string &filename);
|
||||
string GetReplayAppFilename();
|
||||
|
||||
|
||||
@@ -49,6 +49,14 @@ namespace FileIO
|
||||
// in posix/.../..._stringio.cpp
|
||||
const char *GetTempRootPath();
|
||||
|
||||
string GetHomeFolderFilename()
|
||||
{
|
||||
passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
|
||||
return homedir;
|
||||
}
|
||||
|
||||
void CreateParentDirectory(const string &filename)
|
||||
{
|
||||
string fn = dirname(filename);
|
||||
|
||||
@@ -285,6 +285,20 @@ void GetDefaultFiles(const char *logBaseName, string &capture_filename, string &
|
||||
logging_filename = StringFormat::Wide2UTF8(wstring(temp_filename));
|
||||
}
|
||||
|
||||
string GetHomeFolderFilename()
|
||||
{
|
||||
PWSTR docsPath;
|
||||
SHGetKnownFolderPath(FOLDERID_Documents, KF_FLAG_SIMPLE_IDLIST | KF_FLAG_DONT_UNEXPAND, NULL,
|
||||
&docsPath);
|
||||
wstring documents = docsPath;
|
||||
CoTaskMemFree(docsPath);
|
||||
|
||||
if(documents[documents.size() - 1] == '/' || documents[documents.size() - 1] == '\\')
|
||||
documents.pop_back();
|
||||
|
||||
return StringFormat::Wide2UTF8(documents);
|
||||
}
|
||||
|
||||
string GetAppFolderFilename(const string &filename)
|
||||
{
|
||||
PWSTR appDataPath;
|
||||
|
||||
Reference in New Issue
Block a user