summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
blob: beb7f9701e50c34e5222b2395924737ef0422a83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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";
}