-#include <cstdlib>
#include <msp/core/application.h>
+#include <msp/core/environ.h>
+#include <msp/core/except.h>
#include "dir.h"
using namespace std;
Path get_home_dir()
{
- const char *home = getenv("HOME");
- if(home)
+ string home = getenv("HOME");
+ if(!home.empty())
return home;
return ".";
}
-Path get_user_data_dir(const string &)
-{
- return get_user_data_dir();
-}
-
Path get_user_data_dir()
{
const string &appname = Application::get_name();
if(appname.empty())
- throw logic_error("no application name");
+ throw invalid_state("no application name");
return get_home_dir()/("."+appname);
}