Include Filesystem Data from "external" location(s)?

Hello out there!

I frequently use the “Upload Filesystem Image” option.
When selecting this menu option, all files in the sub directory /data are bundled in one file and sent to the connected ESP Filesystem. So far so good.

But I need the files from more than the /data directory. Until now I use I a pre: extra_script to copy the files I need into the /data. It works … but this is not a smooth solution.

The question is: Is there an option to extend the /data by other location(s) that then are included into the Filesystem Imgage?

Thank you!

You are looking for the data_dir setting (data_dir — PlatformIO latest documentation)

Unfortunately this is a single directory setting (“Multiple: no”). So there is just one data dir at a time.

What is your exact usecase and what is the problem with your custom script?

Good morning sivar2311!

So the data_dir option is not what I need. It can only load the ONE local /data OR one “external” data location, not both ….

My usecase is as follows:
I split my arduino projects in two parts. The Part “0” is an application which gives me basic services for a web based project. Like web pages for WiFi Router credentials, a System page for Upload of single files, OTA of firmware, download of protocol. And a /about page which gives me information about the application’s version, memory usage, uptime, IP address and so on. And a bunch of call back routines and flags ….

The “real” application then comes via call back into Part “0”,s setup() and loop() so that the Part “0” is extended by Part “x”. This way, all my applications have the same look for the mentioned service pages, protocol and so on. And I don’t have to care about them every time again.

The consequence is, that at the point of time to upload the filesystem contents, I need both /data directories from Part “0” and Part “x”.

The script method is not wrong, technically speaking. But after using it, the /data from Part “x” (and every Part “x”!) contains all the files from Part “0” and I’d like to avoid this ….

Hopefully I could clarify, what I need…..

Regards
amshh

Afaik this isn’t supported. Wheter from the operating system nor from PlatformIO.
I think you already have the best solution with your custom script.

I’m afraid I have to agree

Maybe the filesystem packer tools follow symbolic links? If you are on Linx or Mac you can easily create a symlink on the commandline. On Windows you have to enable some feature for it. A Python post script is definitely the most compatible way to do it.

Thanks maxgerhardt, I will dig into!