api.h
 1  #pragma once
 2  #include <config.h>
 3  #include <Arduino.h>
 4  #include <ArduinoJson.h>
 5  #include <FS.h>
 6  
 7  struct FilesystemTarget {
 8    fs::FS *fs;
 9    String path;
10    bool ok;
11  };
12  
13  struct FilesystemResolveCommand {
14    String url;
15    FilesystemTarget target;
16  };
17  
18  namespace filesystems::api {
19  
20  bool isSensitivePath(const String &path);
21  bool resolveTarget(FilesystemResolveCommand *command);
22  void listDirectory(fs::FS &filesystem, const String &path, JsonArray &out);
23  bool removeRecursive(fs::FS &filesystem, const String &path);
24  
25  #ifdef PIO_UNIT_TESTING
26  void test();
27  #endif
28  
29  }
30