diff options
author | 2023-09-06 18:16:00 +0000 | |
---|---|---|
committer | 2023-09-06 18:16:00 +0000 | |
commit | 13ab173d417f9b64161b0101d15b63fddf9fc0ee (patch) | |
tree | 43aaf343533ecd7a3c7eab67e6b4e36fa6e6b631 /tools/aapt/Resource.cpp | |
parent | 45d1834d5e63badf9b770d222f479640be8ef658 (diff) | |
parent | 9a80e1b70c9b9aaef268c8c0ea04b3fa5ce3debb (diff) |
Merge "Move String8 path functions to androidfw and aapt" into main am: 713e3930c4 am: 0cfc1c6ddd am: 9a80e1b70c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2723454
Change-Id: I62ce3b1f70692316e65c3531b1dda07ceb25fea8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'tools/aapt/Resource.cpp')
-rw-r--r-- | tools/aapt/Resource.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp index 4a360ed1c80e..647790b01bfa 100644 --- a/tools/aapt/Resource.cpp +++ b/tools/aapt/Resource.cpp @@ -19,6 +19,8 @@ #include "WorkQueue.h" #include "XMLNode.h" +#include <androidfw/PathUtils.h> + #include <algorithm> // STATUST: mingw does seem to redefine UNKNOWN_ERROR from our enum value, so a cast is necessary. @@ -143,8 +145,8 @@ public: mParams.inputFlags, mParams.navigation); } mPath = "res"; - mPath.appendPath(file->getGroupEntry().toDirName(mResType)); - mPath.appendPath(leaf); + appendPath(mPath, file->getGroupEntry().toDirName(mResType)); + appendPath(mPath, leaf); mBaseName = parseResourceName(leaf); if (mBaseName == "") { fprintf(stderr, "Error: malformed resource filename %s\n", @@ -1686,7 +1688,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil ResourceDirIterator it(fonts, String8("font")); while ((err=it.next()) == NO_ERROR) { // fonts can be resources other than xml. - if (it.getFile()->getPath().getPathExtension() == ".xml") { + if (getPathExtension(it.getFile()->getPath()) == ".xml") { String8 src = it.getFile()->getPrintableSource(); err = compileXmlFile(bundle, assets, String16(it.getBaseName()), it.getFile(), &table, xmlFlags); @@ -1716,7 +1718,7 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets, sp<ApkBuil workItem.file, &table, xmlCompilationFlags); if (err == NO_ERROR && workItem.file->hasData()) { - assets->addResource(workItem.resPath.getPathLeaf(), + assets->addResource(getPathLeaf(workItem.resPath), workItem.resPath, workItem.file, workItem.file->getResourceType()); @@ -2851,7 +2853,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets, s++; if (s > last && (*s == '.' || *s == 0)) { String8 part(last, s-last); - dest.appendPath(part); + appendPath(dest, part); #ifdef _WIN32 _mkdir(dest.c_str()); #else @@ -2861,7 +2863,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets, } } while (*s); } - dest.appendPath(className); + appendPath(dest, className); dest.append(".java"); FILE* fp = fopen(dest.c_str(), "w+"); if (fp == NULL) { @@ -2892,7 +2894,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets, if (textSymbolsDest != NULL && R == className) { String8 textDest(textSymbolsDest); - textDest.appendPath(className); + appendPath(textDest, className); textDest.append(".txt"); FILE* fp = fopen(textDest.c_str(), "w+"); @@ -2918,7 +2920,7 @@ status_t writeResourceSymbols(Bundle* bundle, const sp<AaptAssets>& assets, if (bundle->getGenDependencies() && R == className) { // Add this R.java to the dependency file String8 dependencyFile(bundle->getRClassDir()); - dependencyFile.appendPath("R.java.d"); + appendPath(dependencyFile, "R.java.d"); FILE *fp = fopen(dependencyFile.c_str(), "a"); fprintf(fp,"%s \\\n", dest.c_str()); |