MCPcopy Create free account
hub / github.com/BruceDevices/firmware / buildPngBinPath

Function buildPngBinPath

src/core/display.cpp:1798–1809  ·  view source on GitHub ↗

Build a cache path alongside the PNG: /tmp/ .bin

Source from the content-addressed store, hash-verified

1796
1797// Build a cache path alongside the PNG: <dir>/tmp/<basename>.bin
1798static String buildPngBinPath(const String &pngPath) {
1799 int slash = pngPath.lastIndexOf('/');
1800 String dir = (slash >= 0) ? pngPath.substring(0, slash) : "";
1801 String name = pngPath.substring(slash + 1);
1802 int dot = name.lastIndexOf('.');
1803 if (dot > 0) name = name.substring(0, dot);
1804
1805 String tmpDir = dir.length() ? dir + "/tmp" : "/tmp";
1806 if (!tmpDir.startsWith("/")) tmpDir = "/" + tmpDir;
1807
1808 return tmpDir + "/" + name + ".bin";
1809}
1810
1811static bool ensureTmpDir(FS &fs, const String &binPath) {
1812 int slash = binPath.lastIndexOf('/');

Callers 1

drawPNGFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected