diff options
author | 2023-09-06 18:52:41 +0000 | |
---|---|---|
committer | 2023-09-06 18:52:41 +0000 | |
commit | 4fb86ec92a08a65e2ab52f8e361edb15b380cfc4 (patch) | |
tree | a5bbde4223f39d17c527fbd38c100d539cf86339 /tools/aapt/Resource.cpp | |
parent | 65a02ad0798646eb68c06c2166a2e306fb1b6d1c (diff) | |
parent | 13ab173d417f9b64161b0101d15b63fddf9fc0ee (diff) |
Merge "Move String8 path functions to androidfw and aapt" into main am: 713e3930c4 am: 0cfc1c6ddd am: 9a80e1b70c am: 13ab173d41
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2723454
Change-Id: Id68d9725e711288d95290e07d3f656ed848fb69c
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()); |