diff options
author | 2023-08-23 20:36:59 +0000 | |
---|---|---|
committer | 2023-08-23 20:36:59 +0000 | |
commit | 09e51cbebd3cb3f2e3d8ddbdc89584367e447e6a (patch) | |
tree | 0a6bc420852e8de269ad2c3e908084161c4acb06 /cmds/bootanimation/BootAnimation.cpp | |
parent | 482ddf2ae1d5d8f2e1e08a901b7cd1d7a3631192 (diff) | |
parent | c9a386e0de94c124d2f164d9a4c5d6fcfc50cc42 (diff) |
Merge "Migrate from android::String path functions to std::filesystem" into main am: e27e15d330 am: 51858976fe am: b0f9564c48 am: e57b90e810 am: c9a386e0de
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2721506
Change-Id: If0df1da5708bd340dfe1fc505bef53f2a51592fe
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r-- | cmds/bootanimation/BootAnimation.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 774ba7460c6b..b56dceb9393f 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "BootAnimation" #define ATRACE_TAG ATRACE_TAG_GRAPHICS +#include <filesystem> #include <vector> #include <stdint.h> @@ -1306,10 +1307,10 @@ bool BootAnimation::preloadZip(Animation& animation) { continue; } - const String8 entryName(name); - const String8 path(entryName.getPathDir()); - const String8 leaf(entryName.getPathLeaf()); - if (leaf.size() > 0) { + const std::filesystem::path entryName(name); + const std::filesystem::path path(entryName.parent_path()); + const std::filesystem::path leaf(entryName.filename()); + if (!leaf.empty()) { if (entryName == CLOCK_FONT_ZIP_NAME) { FileMap* map = zip->createEntryFileMap(entry); if (map) { @@ -1327,7 +1328,7 @@ bool BootAnimation::preloadZip(Animation& animation) { } for (size_t j = 0; j < pcount; j++) { - if (path == animation.parts[j].path) { + if (path.string() == animation.parts[j].path.c_str()) { uint16_t method; // supports only stored png files if (zip->getEntryInfo(entry, &method, nullptr, nullptr, nullptr, nullptr, nullptr)) { @@ -1344,7 +1345,7 @@ bool BootAnimation::preloadZip(Animation& animation) { map->getDataLength()); } else { Animation::Frame frame; - frame.name = leaf; + frame.name = leaf.c_str(); frame.map = map; frame.trimWidth = animation.width; frame.trimHeight = animation.height; |