+#include <msp/core/application.h>
+#include <msp/core/environ.h>
#include "dir.h"
using namespace std;
if(len)
return string(buf, len);
- const char *home = getenv("HOME");
- if(home)
+ string home = getenv("HOME");
+ if(!home.empty())
return home;
return ".";
}
-Path get_user_data_dir(const string &appname)
+Path get_user_data_dir()
{
+ const string &appname = Application::get_name();
+ if(appname.empty())
+ throw logic_error("no application name");
+
char buf[1024];
unsigned len = get_application_support_dir(buf, sizeof(buf));
if(len)