]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/windows/dir_location.cpp
Fix references to deprecated functions
[libs/core.git] / source / fs / windows / dir_location.cpp
index ea542be3a75abcf87b68fec82edc83734bfa93a6..a1d24de672e7c51857dd361fcbd9fbb3877f7c8f 100644 (file)
@@ -1,4 +1,5 @@
 #include <shlobj.h>
+#include <msp/core/application.h>
 #include "dir.h"
 
 using namespace std;
@@ -14,10 +15,17 @@ Path get_home_dir()
        return ".";
 }
 
-Path get_user_data_dir(const string &appname)
+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 invalid_argument("get_user_data_dir");
+               throw logic_error("no application name");
+
        char datadir[MAX_PATH];
        if(SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, 0, 0, datadir)==S_OK)
                return Path(datadir)/appname;