13 char *base = SDL_GetBasePath();
14 char *pref = SDL_GetPrefPath("localhorst", "tacos");
16 asset_path = string(base) + "assets/";
23 void Config::ReadArgs(int argc, const char *const *argv) {
26 for (int i = 1; i < argc; ++i) {
27 const char *arg = argv[i];
28 if (!arg || arg[0] == '\0') {
29 cerr << "empty argument at position " << i << endl;
32 if (arg[0] != '-' || arg[1] != '-' || arg[2] == '\0') {
33 cerr << "incomplete argument at position " << i << endl;
36 const char *name = arg + 2;
37 if (strcmp(name, "asset-path") == 0) {
39 if (i >= argc || !argv[i]) {
40 cerr << "missing argument to --asset-path" << endl;
44 } else if (strcmp(name, "config-path") == 0) {
46 if (i >= argc || !argv[i]) {
47 cerr << "missing argument to --config-path" << endl;
50 config_path = argv[i];
52 cerr << "unknown argument " << arg << " at position " << i << endl;
57 void Config::ReadFile(const char *path) {
58 // TODO: implement reading config file