Build a cache path alongside the PNG: /tmp/ .bin
| 1796 | |
| 1797 | // Build a cache path alongside the PNG: <dir>/tmp/<basename>.bin |
| 1798 | static 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 | |
| 1811 | static bool ensureTmpDir(FS &fs, const String &binPath) { |
| 1812 | int slash = binPath.lastIndexOf('/'); |