diff options
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/config.cpp b/config.cpp new file mode 100644 index 0000000..beb7f97 --- /dev/null +++ b/config.cpp @@ -0,0 +1,26 @@ +#include "config.h" + +#include <string> +#include <filesystem> + +namespace fs = std::filesystem; + +Config::Config(int argc, char* argv[]) +{ + m_executable_path = fs::path{argv[0]}.parent_path().string(); +} + +std::string Config::get_executable_path() +{ + return m_executable_path; +} + +std::string Config::get_file_path() +{ + // Just a heuristic: If this exists in current dir, then use this path + if (fs::exists(fs::path{m_executable_path} / "magic1.midi")) { + return m_executable_path; + } + return "/media/usb"; +} + |