7#include <boost/describe/class.hpp>
22 if (!std::filesystem::exists(p))
23 std::filesystem::create_directory(p);
24 std::cout << p <<
"\n";
27 if (!std::filesystem::exists(p))
28 std::filesystem::create_directory(p);
29 std::cout << p <<
"\n";
46 if (!std::filesystem::exists(tempPath))
47 std::filesystem::create_directory(tempPath);
49 std::filesystem::create_directory(tempPath /
"dir");
60 return "%temp%/roarFileServerExample";
64 std::ofstream writer{where, std::ios_base::binary};
72 .routeOptions = {.allowUnsecure =
false},
75 .allowDownload =
true,
77 .allowOverwrite =
false,
79 .allowDeleteOfNonEmptyDirectories =
false,
87 std::uniform_int_distribution<int>
letters{1, 2_MiB};
91 BOOST_DESCRIBE_CLASS(
FileServer, (), (), (), (roar_serve, roar_serveAppdata, roar_customServeOptions))
Definition file_server.hpp:17
std::uniform_int_distribution< int > letters
Definition file_server.hpp:87
void createDummyFile(std::filesystem::path const &where)
Definition file_server.hpp:62
ROAR_SERVE() serve("/bla", "~/roar")
Definition file_server.cpp:7
ROAR_SERVE() serveAppdata("/blub", "%appdata%/roar")
Definition file_server.cpp:16
std::filesystem::path getServePath()
Definition file_server.hpp:43
FileServer()
Definition file_server.hpp:19
std::mt19937 gen
Definition file_server.hpp:86
ROAR_MAKE_LISTENER(FileServer)
#define ROAR_SERVE(HandlerName)
Definition request_listener.hpp:248
std::filesystem::path resolvePath(std::filesystem::path const &path)
Will replace prefixes like "~" and "%appdata%" with actual directories on linux and windows.
Definition special_paths.cpp:73