Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,15 +283,15 @@ namespace crow

///
/// Go through the rules, upgrade them if possible, and add them to the list of rules
void validate()
void validate(std::string staticDir = CROW_STATIC_DIRECTORY)
{
if (!validated_)
{

#ifndef CROW_DISABLE_STATIC_DIR

// stat on windows doesn't care whether '/' or '\' is being used. on Linux however, using '\' doesn't work. therefore every instance of '\' gets replaced with '/' then a check is done to make sure the directory ends with '/'.
std::string static_dir_(CROW_STATIC_DIRECTORY);
std::string static_dir_(staticDir);
std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
if (static_dir_[static_dir_.length() - 1] != '/')
static_dir_ += '/';
Expand Down Expand Up @@ -332,10 +332,10 @@ namespace crow
}

/// Run the server
void run()
void run(std::string staticDir = CROW_STATIC_DIRECTORY)
{

validate();
validate(staticDir);

#ifdef CROW_ENABLE_SSL
if (ssl_used_)
Expand Down Expand Up @@ -368,10 +368,10 @@ namespace crow
///
/// The output from this method needs to be saved into a variable!
/// Otherwise the call will be made on the same thread.
std::future<void> run_async()
std::future<void> run_async(std::string staticDir = CROW_STATIC_DIRECTORY)
{
return std::async(std::launch::async, [&] {
this->run();
this->run(staticDir);
});
}

Expand Down
2 changes: 1 addition & 1 deletion include/crow/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -1675,7 +1675,7 @@ namespace crow
}
else
{
#if defined(__APPLE__) || defined(__MACH__) || defined (__FreeBSD__)
#if defined(__APPLE__) || defined(__MACH__) || defined (__FreeBSD__) || defined (__ANDROID__)
o = std::unique_ptr<object>(new object(value));
#else
(*o) = value;
Expand Down