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

Function getToolInSDK

renderdoc/android/android_tools.cpp:48–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46 return FileIO::exists(path) || FileIO::exists(path + ".exe");
47}
48rdcstr getToolInSDK(ToolDir subdir, const rdcstr &jdkroot, const rdcstr &sdkroot,
49 const rdcstr &toolname)
50{
51 rdcstr toolpath;
52
53 switch(subdir)
54 {
55 case ToolDir::None:
56 {
57 // This indicates the file is not a standard tool and will not exist anywhere but our
58 // distributed folder.
59 break;
60 }
61 case ToolDir::Java:
62 {
63 // if no path is configured, abort
64 if(jdkroot.empty())
65 break;
66
67 toolpath = jdkroot + "/bin/" + toolname;
68
69 if(toolExists(toolpath))
70 return toolpath;
71
72 break;
73 }
74 case ToolDir::BuildTools:
75 case ToolDir::BuildToolsLib:
76 case ToolDir::PlatformTools:
77 {
78 // if no path is configured, abort
79 if(sdkroot.empty())
80 break;
81
82 // if it's in platform tools it's easy, just concatenate the path
83 if(subdir == ToolDir::PlatformTools)
84 {
85 toolpath = sdkroot + "/platform-tools/" + toolname;
86 }
87 else
88 {
89 // otherwise we need to find the build-tools versioned folder
90 toolpath = sdkroot + "/build-tools/";
91
92 rdcarray<PathEntry> paths;
93 FileIO::GetFilesInDirectory(toolpath, paths);
94
95 if(paths.empty())
96 break;
97
98 uint32_t bestversion = 0;
99 rdcstr bestpath;
100
101 for(const PathEntry &path : paths)
102 {
103 // skip non-directories
104 if(!(path.flags & PathProperty::Directory))
105 continue;

Callers 1

getToolPathFunction · 0.85

Calls 3

toolExistsFunction · 0.85
GetFilesInDirectoryFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected