X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Funix%2Fdir_location.cpp;fp=source%2Ffs%2Funix%2Fdir_location.cpp;h=e81b8b97a55bba9b5fcc5e806018b494da84f3ac;hb=e2b5cb6cd61bf8c6f56f624cc835233df92288da;hp=0000000000000000000000000000000000000000;hpb=edf916d784e503505ddac2acef6f3e9a72abb0d6;p=libs%2Fcore.git diff --git a/source/fs/unix/dir_location.cpp b/source/fs/unix/dir_location.cpp new file mode 100644 index 0000000..e81b8b9 --- /dev/null +++ b/source/fs/unix/dir_location.cpp @@ -0,0 +1,25 @@ +#include +#include "dir.h" + +using namespace std; + +namespace Msp { +namespace FS { + +Path get_home_dir() +{ + const char *home = getenv("HOME"); + if(home) + return home; + return "."; +} + +Path get_user_data_dir(const string &appname) +{ + if(appname.empty()) + throw invalid_argument("get_user_data_dir"); + return get_home_dir()/("."+appname); +} + +} // namespace FS +} // namespace Msp