X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ffs%2Fwindows%2Fdir_location.cpp;h=4f9b8f643b723b9317af370a84dbc8b7e6529b8e;hb=HEAD;hp=a1d24de672e7c51857dd361fcbd9fbb3877f7c8f;hpb=9e98607f1b6a2c757de51fca6c1649cbdf536597;p=libs%2Fcore.git diff --git a/source/fs/windows/dir_location.cpp b/source/fs/windows/dir_location.cpp index a1d24de..85c5c2f 100644 --- a/source/fs/windows/dir_location.cpp +++ b/source/fs/windows/dir_location.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "dir.h" using namespace std; @@ -10,24 +11,19 @@ namespace FS { Path get_home_dir() { char home[MAX_PATH]; - if(SHGetFolderPath(0, CSIDL_PERSONAL, 0, 0, home)==S_OK) + if(SHGetFolderPath(nullptr, CSIDL_PERSONAL, nullptr, 0, home)==S_OK) return home; return "."; } -Path get_user_data_dir(const string &) -{ - return get_user_data_dir(); -} - Path get_user_data_dir() { const string &appname = Application::get_name(); if(appname.empty()) - throw logic_error("no application name"); + throw invalid_state("no application name"); char datadir[MAX_PATH]; - if(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, 0, datadir)==S_OK) + if(SHGetFolderPath(nullptr, CSIDL_LOCAL_APPDATA, nullptr, 0, datadir)==S_OK) return Path(datadir)/appname; return "."; }