Revision: 71891
          http://sourceforge.net/p/brlcad/code/71891
Author:   starseeker
Date:     2018-09-27 21:54:59 +0000 (Thu, 27 Sep 2018)
Log Message:
-----------
Fix libbu build on Windows

Modified Paths:
--------------
    brlcad/trunk/src/libbu/dir.c

Modified: brlcad/trunk/src/libbu/dir.c
===================================================================
--- brlcad/trunk/src/libbu/dir.c        2018-09-27 21:31:12 UTC (rev 71890)
+++ brlcad/trunk/src/libbu/dir.c        2018-09-27 21:54:59 UTC (rev 71891)
@@ -38,6 +38,9 @@
 #  include <pwd.h>
 #endif
 #include "bio.h"
+#ifdef HAVE_WINDOWS_H
+#  include <ShlObj.h>
+#endif
 
 #include "bu/app.h"
 #include "bu/vls.h"
@@ -156,9 +159,9 @@
 #ifdef HAVE_WINDOWS_H
     if (BU_STR_EMPTY(path)) {
        PWSTR wpath;
-       if (SHGetKnownFolderPath(FOLDERID_Profile, 0, NULL, &wpath) == S_OK) {
-           wcscpy_s(path, MAXPATHLEN, wpath);
-           CoTaskMemFree(wpath);
+       if (SHGetKnownFolderPath(&FOLDERID_Profile, 0, NULL, &wpath) == S_OK) {
+               wcstombs(path, wpath, MAXPATHLEN);
+               CoTaskMemFree(wpath);
        }
     }
 #endif
@@ -204,8 +207,8 @@
 #ifdef HAVE_WINDOWS_H
     if (BU_STR_EMPTY(path)) {
        PWSTR wpath;
-       if (SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &wpath) == 
S_OK) {
-           wcscpy_s(path, MAXPATHLEN, wpath);
+       if (SHGetKnownFolderPath(&FOLDERID_RoamingAppData, 0, NULL, &wpath) == 
S_OK) {
+               wcstombs(path, wpath, MAXPATHLEN);
            CoTaskMemFree(wpath);
        }
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to