X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fosx%2Fdir_location.cpp;h=b58b971961e25cdb83db4abe9f51e31c917c0fef;hb=HEAD;hp=7ce89f7a33de31bdf83e76d31c3da513811ca437;hpb=1a563cfd722a5571428562259790b4948980dd4f;p=libs%2Fcore.git diff --git a/source/fs/osx/dir_location.cpp b/source/fs/osx/dir_location.cpp index 7ce89f7..13aa3d2 100644 --- a/source/fs/osx/dir_location.cpp +++ b/source/fs/osx/dir_location.cpp @@ -1,3 +1,6 @@ +#include +#include +#include #include "dir.h" using namespace std; @@ -15,15 +18,19 @@ Path get_home_dir() 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 invalid_state("no application name"); + char buf[1024]; unsigned len = get_application_support_dir(buf, sizeof(buf)); if(len)