MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / GetDexCanonicalLocation

Method GetDexCanonicalLocation

Bcore/src/main/cpp/dex/dex_file_loader.cc:189–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189std::string DexFileLoader::GetDexCanonicalLocation(const char* dex_location) {
190 CHECK_NE(dex_location, static_cast<const char*>(nullptr));
191 std::string base_location = GetBaseLocation(dex_location);
192 const char* suffix = dex_location + base_location.size();
193 DCHECK(suffix[0] == 0 || suffix[0] == kMultiDexSeparator);
194 // Warning: Bionic implementation of realpath() allocates > 12KB on the stack.
195 // Do not run this code on a small stack, e.g. in signal handler.
196 UniqueCPtr<const char[]> path(realpath(base_location.c_str(), nullptr));
197 if (path != nullptr && path.get() != base_location) {
198 return std::string(path.get()) + suffix;
199 } else if (suffix[0] == 0) {
200 return base_location;
201 } else {
202 return dex_location;
203 }
204}
205
206// All of the implementations here should be independent of the runtime.
207// TODO: implement all the virtual methods.

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected