From 9dcea573208cde8353a79e9433390809031473d4 Mon Sep 17 00:00:00 2001 From: Tomasz Wasilczyk Date: Tue, 22 Aug 2023 20:39:20 +0000 Subject: Migrate from android::String path functions to std::filesystem Bug: 295394788 Test: m checkbuild Change-Id: I2e3167aaf464132127d5838075c7f9a5257ed275 --- cmds/bootanimation/BootAnimation.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cmds/bootanimation/BootAnimation.cpp') diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp index 5b9d989bdfe6..8ceb9ec13d88 100644 --- a/cmds/bootanimation/BootAnimation.cpp +++ b/cmds/bootanimation/BootAnimation.cpp @@ -17,6 +17,7 @@ #define LOG_NDEBUG 0 #define LOG_TAG "BootAnimation" +#include #include #include @@ -1271,10 +1272,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) { @@ -1292,7 +1293,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)) { @@ -1309,7 +1310,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; -- cgit v1.2.3-59-g8ed1b