]> git.tdb.fi Git - libs/core.git/blob - source/fs/unix/dir_location.cpp
Fix references to deprecated functions
[libs/core.git] / source / fs / unix / dir_location.cpp
1 #include <cstdlib>
2 #include <msp/core/application.h>
3 #include "dir.h"
4
5 using namespace std;
6
7 namespace Msp {
8 namespace FS {
9
10 Path get_home_dir()
11 {
12         const char *home = getenv("HOME");
13         if(home)
14                 return home;
15         return ".";
16 }
17
18 Path get_user_data_dir(const string &)
19 {
20         return get_user_data_dir();
21 }
22
23 Path get_user_data_dir()
24 {
25         const string &appname = Application::get_name();
26         if(appname.empty())
27                 throw logic_error("no application name");
28
29         return get_home_dir()/("."+appname);
30 }
31
32 } // namespace FS
33 } // namespace Msp