- char buf[1024];
- return ::getcwd(buf, sizeof(buf));
-}
-
-Path get_home_dir()
-{
-#ifdef WIN32
- char home[MAX_PATH];
- if(SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, home)==S_OK)
- return home;
-#else
- const char *home = getenv("HOME");
- if(home)
- return home;
-#endif
- return ".";
-}
-
-Path get_user_data_dir(const string &appname)
-{
-#ifdef WIN32
- char datadir[MAX_PATH];
- if(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, 0, datadir)==S_OK)
- return Path(datadir)/appname;
- return ".";
-#else
- return get_home_dir()/("."+appname);
-#endif
+ const string &name = Application::get_name();
+ if(name.empty())
+ throw logic_error("application name not known");
+ return get_user_data_dir(name);