MCPcopy Create free account
hub / github.com/baldurk/renderdoc / LocatePluginFile

Function LocatePluginFile

renderdoc/core/plugins.cpp:29–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27#include "strings/string_utils.h"
28
29rdcstr LocatePluginFile(const rdcstr &path, const rdcstr &fileName)
30{
31 rdcstr ret;
32
33 rdcstr libpath;
34 FileIO::GetLibraryFilename(libpath);
35 libpath = get_dirname(libpath);
36
37 rdcarray<rdcstr> paths;
38
39#if defined(RENDERDOC_PLUGINS_PATH)
40 string customPath(RENDERDOC_PLUGINS_PATH);
41
42 if(FileIO::IsRelativePath(customPath))
43 customPath = libpath + "/" + customPath;
44
45 paths.push_back(customPath);
46#endif
47
48 // windows installation
49 paths.push_back(libpath + "/plugins");
50 // linux installation
51 paths.push_back(libpath + "/../share/renderdoc/plugins");
52// also search the appropriate OS-specific location in the root
53#if ENABLED(RDOC_WIN32) && ENABLED(RDOC_X64)
54 paths.push_back(libpath + "/../../plugins-win64");
55#endif
56
57#if ENABLED(RDOC_WIN32) && DISABLED(RDOC_X64)
58 paths.push_back(libpath + "/../../plugins-win32");
59#endif
60
61#if ENABLED(RDOC_LINUX)
62 paths.push_back(libpath + "/../../plugins-linux64");
63#endif
64
65 // there is no standard path for local builds as we don't provide these plugins in the repository
66 // directly. As a courtesy we search the root of the build, from the executable. The user can
67 // always put the plugins folder relative to the exe where it would be in an installation too.
68 paths.push_back(libpath + "/../../plugins");
69
70 // in future maybe we want to search a user-specific plugins folder? Like ~/.renderdoc/ on linux
71 // or %APPDATA%/renderdoc on windows?
72
73 for(uint32_t i = 0; i < paths.size(); i++)
74 {
75 rdcstr check = paths[i] + "/" + path + "/" + fileName;
76 if(FileIO::exists(check))
77 {
78 ret = check;
79 break;
80 }
81 }
82
83 // if we didn't find it anywhere, just try running it directly in case it's in the PATH
84 if(ret.empty())
85 ret = fileName;
86

Callers 12

GetEGLHandleFunction · 0.85
InitMethod · 0.85
NVAftermath_InitFunction · 0.85
InitialiseAGSReplayFunction · 0.85
AMDRGPControlMethod · 0.85
CheckForSupportFunction · 0.85
DisassembleSPIRVFunction · 0.85
DisassembleGLSLFunction · 0.85
GetAMDModuleFunction · 0.85
InitMethod · 0.85
SearchForDXCFunction · 0.85
D3D12_CreateReplayDeviceFunction · 0.85

Calls 7

get_dirnameFunction · 0.85
GetLibraryFilenameFunction · 0.50
IsRelativePathFunction · 0.50
existsFunction · 0.50
push_backMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected