]> git.tdb.fi Git - libs/core.git/blob - source/fs/unix/dir_location.cpp
Have get_user_data_dir return a proper location on Android
[libs/core.git] / source / fs / unix / dir_location.cpp
1 #include <cstdlib>
2 #include "dir.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace FS {
8
9 Path get_home_dir()
10 {
11         const char *home = getenv("HOME");
12         if(home)
13                 return home;
14         return ".";
15 }
16
17 Path get_user_data_dir(const string &appname)
18 {
19         if(appname.empty())
20                 throw invalid_argument("get_user_data_dir");
21         return get_home_dir()/("."+appname);
22 }
23
24 } // namespace FS
25 } // namespace Msp