1 #include <msp/core/application.h>
2 #include <msp/core/environ.h>
3 #include <msp/core/except.h>
8 extern "C" unsigned get_home_dir(char *, unsigned);
9 extern "C" unsigned get_application_support_dir(char *, unsigned);
17 unsigned len = ::get_home_dir(buf, sizeof(buf));
19 return string(buf, len);
21 string home = getenv("HOME");
28 Path get_user_data_dir()
30 const string &appname = Application::get_name();
32 throw invalid_state("no application name");
35 unsigned len = get_application_support_dir(buf, sizeof(buf));
37 return Path(string(buf, len))/appname;
38 return get_home_dir()/"Library"/"Application Support"/appname;