From 8c94ce99b26ac93f96a953dc4205c866ea57f888 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 8 Oct 2022 09:23:00 +0200 Subject: [PATCH] quick fix for filesystem initialization --- CHANGELOG.md | 6 ++++++ lib/framework/FSPersistence.h | 10 ++++++++++ src/version.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da986fc6a..e81334aff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +# [3.4.3] + +## Fixed + +- Fix for new installations with filesystem not initializing + # [3.4.2] ## Added diff --git a/lib/framework/FSPersistence.h b/lib/framework/FSPersistence.h index 52c96d7ed..688f1c231 100644 --- a/lib/framework/FSPersistence.h +++ b/lib/framework/FSPersistence.h @@ -85,6 +85,16 @@ class FSPersistence { #endif #endif + // make directories if required, for new IDF4.2 & LittleFS + String path(_filePath); + int index = 0; + while ((index = path.indexOf('/', index + 1)) != -1) { + String segment = path.substring(0, index); + if (!_fs->exists(segment)) { + _fs->mkdir(segment); + } + } + // serialize the data to the file serializeJson(jsonDocument, settingsFile); settingsFile.close(); diff --git a/src/version.h b/src/version.h index 0cdf74098..c1dc7ea49 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define EMSESP_APP_VERSION "3.4.2" +#define EMSESP_APP_VERSION "3.4.3"