nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
settings.h
Go to the documentation of this file.
1#ifndef NANOMMO_PROTOCOL_SETTINGS_H_
2#define NANOMMO_PROTOCOL_SETTINGS_H_
3
4#include <cstdlib>
5#include <string>
6
7namespace nanommo {
8
9inline std::string Setting(const char* name, const std::string& fallback) {
10 const char* value = std::getenv(name);
11 return value != nullptr ? value : fallback;
12}
13
14/// A file or a folder a program reads: the setting called name, if it's set,
15/// or else path in the repository the program was built from, so it runs from
16/// any folder. Where the repository hasn't got it, as in a Docker image, which
17/// leaves the repository behind, path is from the folder it runs in. A path in
18/// neither comes back from the repository, where an error should send you.
19std::string FileSetting(const char* name, const std::string& path);
20
21} // namespace nanommo
22
23#endif // NANOMMO_PROTOCOL_SETTINGS_H_
Definition chat.cc:9
std::string Setting(const char *name, const std::string &fallback)
Definition settings.h:9
std::string FileSetting(const char *name, const std::string &path)
Definition settings.cc:22