mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-14 05:50:51 +00:00
Expand capture pathnames to full before passing over remote access
* This fixes the issue where an application might have set the capture path as relative, and a relative path is passed to the UI which has no idea what working directory the path is relative to.
This commit is contained in:
@@ -120,9 +120,11 @@ void RenderDoc::RemoteAccessClientThread(void *s)
|
||||
|
||||
packetType = ePacket_NewCapture;
|
||||
|
||||
std::string path = FileIO::GetFullPathname(captures.back().path);
|
||||
|
||||
ser.Serialise("", idx);
|
||||
ser.Serialise("", captures.back().timestamp);
|
||||
ser.Serialise("", captures.back().path);
|
||||
ser.Serialise("", path);
|
||||
|
||||
uint32_t len = 0;
|
||||
RENDERDOC_GetThumbnail(captures.back().path.c_str(), NULL, len);
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Keyboard
|
||||
|
||||
namespace FileIO
|
||||
{
|
||||
string GetAppFolderFilename(string filename)
|
||||
string GetAppFolderFilename(const string &filename)
|
||||
{
|
||||
passwd *pw = getpwuid(getuid());
|
||||
const char *homedir = pw->pw_dir;
|
||||
@@ -145,6 +145,14 @@ namespace FileIO
|
||||
return ret + filename;
|
||||
}
|
||||
|
||||
string GetFullPathname(const string &filename)
|
||||
{
|
||||
char path[512] = {0};
|
||||
readlink(filename.c_str(), path, 511);
|
||||
|
||||
return string(path);
|
||||
}
|
||||
|
||||
void GetExecutableFilename(string &selfName)
|
||||
{
|
||||
char path[512] = {0};
|
||||
@@ -238,10 +246,10 @@ namespace FileIO
|
||||
logging_filename = string(temp_filename);
|
||||
}
|
||||
|
||||
uint64_t GetModifiedTimestamp(const char *filename)
|
||||
uint64_t GetModifiedTimestamp(const string &filename)
|
||||
{
|
||||
struct ::stat st;
|
||||
int res = stat(filename, &st);
|
||||
int res = stat(filename.c_str(), &st);
|
||||
|
||||
if(res == 0)
|
||||
{
|
||||
|
||||
@@ -174,12 +174,14 @@ namespace Callstack
|
||||
namespace FileIO
|
||||
{
|
||||
void GetDefaultFiles(const char *logBaseName, string &capture_filename, string &logging_filename, string &target);
|
||||
string GetAppFolderFilename(string filename);
|
||||
string GetAppFolderFilename(const string &filename);
|
||||
string GetReplayAppFilename();
|
||||
|
||||
string GetFullPathname(const string &filename);
|
||||
|
||||
void GetExecutableFilename(string &selfName);
|
||||
|
||||
uint64_t GetModifiedTimestamp(const char *filename);
|
||||
uint64_t GetModifiedTimestamp(const string &filename);
|
||||
|
||||
void Copy(const char *from, const char *to, bool allowOverwrite);
|
||||
void Delete(const char *path);
|
||||
|
||||
@@ -160,6 +160,16 @@ namespace FileIO
|
||||
selfName = StringFormat::Wide2UTF8(wstring(curFile));
|
||||
}
|
||||
|
||||
string GetFullPathname(const string &filename)
|
||||
{
|
||||
wstring wfn = StringFormat::UTF82Wide(filename);
|
||||
|
||||
wchar_t path[512] = {0};
|
||||
GetFullPathNameW(wfn.c_str(), ARRAY_COUNT(path)-1, path, NULL);
|
||||
|
||||
return StringFormat::Wide2UTF8(wstring(path));
|
||||
}
|
||||
|
||||
string GetReplayAppFilename()
|
||||
{
|
||||
HMODULE hModule = NULL;
|
||||
@@ -251,7 +261,7 @@ namespace FileIO
|
||||
logging_filename = StringFormat::Wide2UTF8(wstring(temp_filename));
|
||||
}
|
||||
|
||||
string GetAppFolderFilename(string filename)
|
||||
string GetAppFolderFilename(const string &filename)
|
||||
{
|
||||
PWSTR appDataPath;
|
||||
SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_SIMPLE_IDLIST|KF_FLAG_DONT_UNEXPAND, NULL, &appDataPath);
|
||||
@@ -268,9 +278,9 @@ namespace FileIO
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t GetModifiedTimestamp(const char *filename)
|
||||
uint64_t GetModifiedTimestamp(const string &filename)
|
||||
{
|
||||
wstring wfn = StringFormat::UTF82Wide(string(filename));
|
||||
wstring wfn = StringFormat::UTF82Wide(filename);
|
||||
|
||||
struct _stat st;
|
||||
int res = _wstat(wfn.c_str(), &st);
|
||||
|
||||
Reference in New Issue
Block a user