Automated merge with head of lindenlab/viewer64

Mon, 18 Dec 2017 17:14:28 -0800

author
callum_linden <callum@lindenlab.com>
date
Mon, 18 Dec 2017 17:14:28 -0800
changeset 55047
f66c53f7d508
parent 55046
ab438756835d
parent 54584
7c191babc4f6
child 55048
4d9e8c74f8fd

Automated merge with head of lindenlab/viewer64

autobuild.xml file | annotate | diff | revisions
     1.1 --- a/autobuild.xml	Fri Dec 15 16:11:29 2017 -0800
     1.2 +++ b/autobuild.xml	Mon Dec 18 17:14:28 2017 -0800
     1.3 @@ -3231,9 +3231,9 @@
     1.4              <key>archive</key>
     1.5              <map>
     1.6                <key>hash</key>
     1.7 -              <string>8bb2754bb078713f875e7374c95294fc</string>
     1.8 +              <string>a1cc313f9238316a514b8d3056f86b31</string>
     1.9                <key>url</key>
    1.10 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/11619/66949/viewer_manager-1.0.511355-darwin64-511355.tar.bz2</string>
    1.11 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/11774/68078/viewer_manager-1.0.511462-darwin64-511462.tar.bz2</string>
    1.12              </map>
    1.13              <key>name</key>
    1.14              <string>darwin64</string>
    1.15 @@ -3255,9 +3255,9 @@
    1.16              <key>archive</key>
    1.17              <map>
    1.18                <key>hash</key>
    1.19 -              <string>cc406ba4d9250e4c959c99b64877248f</string>
    1.20 +              <string>73894a49bd63e06adc0e365efae6e03e</string>
    1.21                <key>url</key>
    1.22 -              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/11620/66955/viewer_manager-1.0.511355-windows-511355.tar.bz2</string>
    1.23 +              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/11775/68084/viewer_manager-1.0.511462-windows-511462.tar.bz2</string>
    1.24              </map>
    1.25              <key>name</key>
    1.26              <string>windows</string>
    1.27 @@ -3268,7 +3268,7 @@
    1.28          <key>source_type</key>
    1.29          <string>hg</string>
    1.30          <key>version</key>
    1.31 -        <string>1.0.511355</string>
    1.32 +        <string>1.0.511462</string>
    1.33        </map>
    1.34        <key>vlc-bin</key>
    1.35        <map>
     2.1 --- a/indra/llvfs/lldir_win32.cpp	Fri Dec 15 16:11:29 2017 -0800
     2.2 +++ b/indra/llvfs/lldir_win32.cpp	Mon Dec 18 17:14:28 2017 -0800
     2.3 @@ -31,7 +31,11 @@
     2.4  #include "lldir_win32.h"
     2.5  #include "llerror.h"
     2.6  #include "llrand.h"		// for gLindenLabRandomNumber
     2.7 -#include "shlobj.h"
     2.8 +#include <shlobj.h>
     2.9 +#include <Knownfolders.h>
    2.10 +#include <iostream>
    2.11 +#include <map>
    2.12 +#include <Objbase.h>                // CoTaskMemFree()
    2.13  
    2.14  #include <direct.h>
    2.15  #include <errno.h>
    2.16 @@ -42,30 +46,59 @@
    2.17  #define PACKVERSION(major,minor) MAKELONG(minor,major)
    2.18  DWORD GetDllVersion(LPCTSTR lpszDllName);
    2.19  
    2.20 +namespace {
    2.21 +
    2.22 +std::string getKnownFolderPath(const std::string& desc, REFKNOWNFOLDERID folderid)
    2.23 +{
    2.24 +    // https://msdn.microsoft.com/en-us/library/windows/desktop/bb762188(v=vs.85).aspx
    2.25 +    PWSTR wstrptr = 0;
    2.26 +    HRESULT result = SHGetKnownFolderPath(
    2.27 +        folderid,
    2.28 +        KF_FLAG_DEFAULT,            // no flags
    2.29 +        NULL,                       // current user, no impersonation
    2.30 +        &wstrptr);
    2.31 +    if (result == S_OK)
    2.32 +    {
    2.33 +        std::string utf8 = utf16str_to_utf8str(llutf16string(wstrptr));
    2.34 +        // have to free the returned pointer after copying its data
    2.35 +        CoTaskMemFree(wstrptr);
    2.36 +        return utf8;
    2.37 +    }
    2.38 +
    2.39 +    // gack, no logging yet!
    2.40 +    // at least say something to a developer trying to debug this...
    2.41 +    static std::map<HRESULT, const char*> codes
    2.42 +    {
    2.43 +        { E_FAIL, "E_FAIL; known folder does not have a path?" },
    2.44 +        { E_INVALIDARG, "E_INVALIDARG; not present on system?" }
    2.45 +    };
    2.46 +    auto found = codes.find(result);
    2.47 +    const char* text = (found == codes.end())? "unknown" : found->second;
    2.48 +    std::cout << "*** SHGetKnownFolderPath(" << desc << ") failed with "
    2.49 +              << result << " (" << text << ")\n";
    2.50 +    return {};
    2.51 +}
    2.52 +
    2.53 +} // anonymous namespace
    2.54 +
    2.55  LLDir_Win32::LLDir_Win32()
    2.56  {
    2.57  	mDirDelimiter = "\\";
    2.58  
    2.59 -	WCHAR w_str[MAX_PATH];
    2.60 -
    2.61  	// Application Data is where user settings go
    2.62 -	SHGetSpecialFolderPath(NULL, w_str, CSIDL_APPDATA, TRUE);
    2.63 -
    2.64 -	mOSUserDir = utf16str_to_utf8str(llutf16string(w_str));
    2.65 +	mOSUserDir = getKnownFolderPath("RoamingAppData", FOLDERID_RoamingAppData);
    2.66  
    2.67  	// We want cache files to go on the local disk, even if the
    2.68  	// user is on a network with a "roaming profile".
    2.69  	//
    2.70 -	// On XP this is:
    2.71 -	//   C:\Docments and Settings\James\Local Settings\Application Data
    2.72  	// On Vista this is:
    2.73  	//   C:\Users\James\AppData\Local
    2.74  	//
    2.75  	// We used to store the cache in AppData\Roaming, and the installer
    2.76  	// cleans up that version on upgrade.  JC
    2.77 -	SHGetSpecialFolderPath(NULL, w_str, CSIDL_LOCAL_APPDATA, TRUE);
    2.78 -	mOSCacheDir = utf16str_to_utf8str(llutf16string(w_str));
    2.79 +	mOSCacheDir = getKnownFolderPath("LocalAppData", FOLDERID_LocalAppData);
    2.80  
    2.81 +	WCHAR w_str[MAX_PATH];
    2.82  	if (GetTempPath(MAX_PATH, w_str))
    2.83  	{
    2.84  		if (wcslen(w_str))	/* Flawfinder: ignore */ 
    2.85 @@ -73,6 +106,16 @@
    2.86  			w_str[wcslen(w_str)-1] = '\0'; /* Flawfinder: ignore */ // remove trailing slash
    2.87  		}
    2.88  		mTempDir = utf16str_to_utf8str(llutf16string(w_str));
    2.89 +
    2.90 +		if (mOSUserDir.empty())
    2.91 +		{
    2.92 +			mOSUserDir = mTempDir;
    2.93 +		}
    2.94 +
    2.95 +		if (mOSCacheDir.empty())
    2.96 +		{
    2.97 +			mOSCacheDir = mTempDir;
    2.98 +		}
    2.99  	}
   2.100  	else
   2.101  	{
     3.1 --- a/indra/test/CMakeLists.txt	Fri Dec 15 16:11:29 2017 -0800
     3.2 +++ b/indra/test/CMakeLists.txt	Mon Dec 18 17:14:28 2017 -0800
     3.3 @@ -73,6 +73,9 @@
     3.4    list(APPEND test_SOURCE_FILES
     3.5         llmessagetemplateparser_tut.cpp
     3.6         )
     3.7 +  set(EXTRA_WINDOWS_LIBRARIES "")
     3.8 +else (NOT WINDOWS)
     3.9 +  set(EXTRA_WINDOWS_LIBRARIES ole32)
    3.10  endif (NOT WINDOWS)
    3.11  
    3.12  set_source_files_properties(${test_HEADER_FILES}
    3.13 @@ -96,6 +99,7 @@
    3.14      ${GOOGLEMOCK_LIBRARIES}
    3.15      ${PTHREAD_LIBRARY}
    3.16      ${WINDOWS_LIBRARIES}
    3.17 +    ${EXTRA_WINDOWS_LIBRARIES}
    3.18      ${BOOST_PROGRAM_OPTIONS_LIBRARY}
    3.19      ${BOOST_REGEX_LIBRARY}
    3.20      ${BOOST_COROUTINE_LIBRARY}

mercurial