diff options
author | 2023-08-23 02:22:53 +0000 | |
---|---|---|
committer | 2023-09-01 19:05:34 +0000 | |
commit | 804e819c1bf64d4df483107e02e896b29e58b3f1 (patch) | |
tree | 300e8f502c5ca18104016ebe30885d0aecf49125 /tools/aapt/Resource.cpp | |
parent | cc7212ddf54bc9ec55d1f08db39833a7c3d91078 (diff) |
Move String8 path functions to androidfw and aapt
Test: m checkbuild
Bug: 295394788
Change-Id: I9488bc5632cbd47c83f6b5f2df4c87eb324a1e8e
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()); |