Support Windows builds for libartbase/libdexfile
Enable building key libraries for windows tools in the SDK.
Bug: 22322814
Test: run dexdumps on a large APK under wine on Linux
Change-Id: Ib7180f8385300244bf914e9ae1f993e869f71109
diff --git a/libdexfile/dex/dex_file_loader.cc b/libdexfile/dex/dex_file_loader.cc
index 1884bcf..a719d41 100644
--- a/libdexfile/dex/dex_file_loader.cc
+++ b/libdexfile/dex/dex_file_loader.cc
@@ -187,12 +187,18 @@
std::string base_location = GetBaseLocation(dex_location);
const char* suffix = dex_location + base_location.size();
DCHECK(suffix[0] == 0 || suffix[0] == kMultiDexSeparator);
+#ifdef _WIN32
+ // Warning: No symbolic link processing here.
+ PLOG(WARNING) << "realpath is unsupported on Windows.";
+#else
// Warning: Bionic implementation of realpath() allocates > 12KB on the stack.
// Do not run this code on a small stack, e.g. in signal handler.
UniqueCPtr<const char[]> path(realpath(base_location.c_str(), nullptr));
if (path != nullptr && path.get() != base_location) {
return std::string(path.get()) + suffix;
- } else if (suffix[0] == 0) {
+ }
+#endif
+ if (suffix[0] == 0) {
return base_location;
} else {
return dex_location;