summaryrefslogtreecommitdiff
path: root/cmds/bootanimation/BootAnimation.cpp
diff options
context:
space:
mode:
author Tomasz Wasilczyk <twasilczyk@google.com> 2023-08-22 20:39:20 +0000
committer Tomasz Wasilczyk <twasilczyk@google.com> 2023-08-23 17:44:11 +0000
commit9dcea573208cde8353a79e9433390809031473d4 (patch)
tree07c621543a3ad2e8bb2351ccaa3602365a0c67b8 /cmds/bootanimation/BootAnimation.cpp
parenteb1ddf020482df7ea233c28350ee4e51b556b4f6 (diff)
Migrate from android::String path functions to std::filesystem
Bug: 295394788 Test: m checkbuild Change-Id: I2e3167aaf464132127d5838075c7f9a5257ed275
Diffstat (limited to 'cmds/bootanimation/BootAnimation.cpp')
-rw-r--r--cmds/bootanimation/BootAnimation.cpp13
1 files changed, 7 insertions, 6 deletions
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 <filesystem>
#include <vector>
#include <stdint.h>
@@ -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;