--- /dev/null
+#include "config.hpp"
+
+#include <cstring>
+#include <iostream>
+#include <SDL.h>
+
+using namespace std;
+
+
+namespace tacos {
+
+Config::Config() {
+ char *base = SDL_GetBasePath();
+ char *pref = SDL_GetPrefPath("localhorst", "tacos");
+
+ asset_path = string(base) + "assets/";
+ config_path = pref;
+
+ SDL_free(base);
+ SDL_free(pref);
+}
+
+void Config::ReadArgs(int argc, const char *const *argv) {
+ if (argc < 1) return;
+
+ for (int i = 1; i < argc; ++i) {
+ const char *arg = argv[i];
+ if (!arg || arg[0] == '\0') {
+ cerr << "empty argument at position " << i << endl;
+ continue;
+ }
+ if (arg[0] != '-' || arg[1] != '-' || arg[2] == '\0') {
+ cerr << "incomplete argument at position " << i << endl;
+ continue;
+ }
+ const char *name = arg + 2;
+ if (strcmp(name, "asset-path") == 0) {
+ ++i;
+ if (i >= argc || !argv[i]) {
+ cerr << "missing argument to --asset-path" << endl;
+ continue;
+ }
+ asset_path = argv[i];
+ } else if (strcmp(name, "config-path") == 0) {
+ ++i;
+ if (i >= argc || !argv[i]) {
+ cerr << "missing argument to --config-path" << endl;
+ continue;
+ }
+ config_path = argv[i];
+ } else {
+ cerr << "unknown argument " << arg << " at position " << i << endl;
+ }
+ }
+}
+
+void Config::ReadFile(const char *path) {
+ // TODO: implement reading config file
+}
+
+}