]> git.tdb.fi Git - libs/core.git/blob - source/fs/windows/dir_location.cpp
Provide access to the Java VM on Android
[libs/core.git] / source / fs / windows / dir_location.cpp
1 #include <shlobj.h>
2 #include "dir.h"
3
4 using namespace std;
5
6 namespace Msp {
7 namespace FS {
8
9 Path get_home_dir()
10 {
11         char home[MAX_PATH];
12         if(SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, home)==S_OK)
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         char datadir[MAX_PATH];
22         if(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, 0, datadir)==S_OK)
23                 return Path(datadir)/appname;
24         return ".";
25 }
26
27 } // namespace FS
28 } // namespace Msp