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/Images.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/Images.cpp')
-rw-r--r-- | tools/aapt/Images.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/aapt/Images.cpp b/tools/aapt/Images.cpp index c6c7e960ba2a..cd4de90f12f6 100644 --- a/tools/aapt/Images.cpp +++ b/tools/aapt/Images.cpp @@ -8,6 +8,7 @@ #include "Images.h" +#include <androidfw/PathUtils.h> #include <androidfw/ResourceTypes.h> #include <utils/ByteOrder.h> @@ -1357,7 +1358,7 @@ static bool write_png_protected(png_structp write_ptr, String8& printableName, p status_t preProcessImage(const Bundle* bundle, const sp<AaptAssets>& /* assets */, const sp<AaptFile>& file, String8* /* outNewLeafName */) { - String8 ext(file->getPath().getPathExtension()); + String8 ext(getPathExtension(file->getPath())); // We currently only process PNG images. if (strcmp(ext.c_str(), ".png") != 0) { @@ -1518,7 +1519,7 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con // Check to see if we're dealing with a 9-patch // If we are, process appropriately - if (source.getBasePath().getPathExtension() == ".9") { + if (getPathExtension(getBasePath(source)) == ".9") { if (do_9patch(source.c_str(), &imageInfo) != NO_ERROR) { return error; } @@ -1584,12 +1585,12 @@ status_t preProcessImageToCache(const Bundle* bundle, const String8& source, con status_t postProcessImage(const Bundle* bundle, const sp<AaptAssets>& assets, ResourceTable* table, const sp<AaptFile>& file) { - String8 ext(file->getPath().getPathExtension()); + String8 ext(getPathExtension(file->getPath())); // At this point, now that we have all the resource data, all we need to // do is compile XML files. if (strcmp(ext.c_str(), ".xml") == 0) { - String16 resourceName(parseResourceName(file->getSourceFile().getPathLeaf())); + String16 resourceName(parseResourceName(getPathLeaf(file->getSourceFile()))); return compileXmlFile(bundle, assets, resourceName, file, table); } |