]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/windows/dir_location.cpp
Add move semantics to Variant
[libs/core.git] / source / fs / windows / dir_location.cpp
index 4c3b8668438d52d09c1b4816e745563b544dd75e..85c5c2fa30d1f6809c359cfb7f919605d83fedfb 100644 (file)
@@ -1,5 +1,6 @@
 #include <shlobj.h>
 #include <msp/core/application.h>
+#include <msp/core/except.h>
 #include "dir.h"
 
 using namespace std;
@@ -10,7 +11,7 @@ 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 ".";
 }
@@ -19,10 +20,10 @@ 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 ".";
 }