diff options
Diffstat (limited to 'src/common/utilities.cpp')
-rw-r--r-- | src/common/utilities.cpp | 85 |
1 files changed, 15 insertions, 70 deletions
diff --git a/src/common/utilities.cpp b/src/common/utilities.cpp index d646585c..9d797a66 100644 --- a/src/common/utilities.cpp +++ b/src/common/utilities.cpp @@ -446,82 +446,26 @@ int VariableSortOrder(GLenum type) } +#if !defined(ANGLE_ENABLE_WINDOWS_STORE) std::string getTempPath() { #ifdef ANGLE_PLATFORM_WINDOWS - #if defined(ANGLE_ENABLE_WINDOWS_STORE) - - using namespace Microsoft::WRL; - using namespace Microsoft::WRL::Wrappers; - using namespace ABI::Windows::ApplicationModel::Core; - using namespace ABI::Windows::Foundation; - using namespace ABI::Windows::Foundation::Collections; - - ComPtr<IActivationFactory> pActivationFactory; - ComPtr<ABI::Windows::ApplicationModel::IPackageStatics> packageStatics; - ComPtr<ABI::Windows::ApplicationModel::IPackage> package; - ComPtr<ABI::Windows::Storage::IStorageFolder> storageFolder; - ComPtr<ABI::Windows::Storage::IStorageItem> storageItem; - HString hstrPath; - - HRESULT result = GetActivationFactory(HStringReference(RuntimeClass_Windows_ApplicationModel_Package).Get(), &pActivationFactory); - ASSERT(SUCCEEDED(result)); - if (SUCCEEDED(result)) - { - result = pActivationFactory.As(&packageStatics); - ASSERT(SUCCEEDED(result)); - } - - if (SUCCEEDED(result)) - { - result = packageStatics->get_Current(&package); - ASSERT(SUCCEEDED(result)); - } - - if (SUCCEEDED(result)) - { - result = package->get_InstalledLocation(&storageFolder); - ASSERT(SUCCEEDED(result)); - } - - if (SUCCEEDED(result)) - { - result = storageFolder.As(&storageItem); - ASSERT(SUCCEEDED(result)); - } - - if (SUCCEEDED(result)) - { - result = storageItem->get_Path(hstrPath.GetAddressOf()); - ASSERT(SUCCEEDED(result)); - } - - if (SUCCEEDED(result)) - { - std::wstring t = std::wstring(hstrPath.GetRawBuffer(nullptr)); - return std::string(t.begin(), t.end()); - } - + char path[MAX_PATH]; + DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path); + if (pathLen == 0) + { UNREACHABLE(); return std::string(); - #else - char path[MAX_PATH]; - DWORD pathLen = GetTempPathA(sizeof(path) / sizeof(path[0]), path); - if (pathLen == 0) - { - UNREACHABLE(); - return std::string(); - } + } - UINT unique = GetTempFileNameA(path, "sh", 0, path); - if (unique == 0) - { - UNREACHABLE(); - return std::string(); - } + UINT unique = GetTempFileNameA(path, "sh", 0, path); + if (unique == 0) + { + UNREACHABLE(); + return std::string(); + } - return path; - #endif + return path; #else UNIMPLEMENTED(); return ""; @@ -540,6 +484,7 @@ void writeFile(const char* path, const void* content, size_t size) fwrite(content, sizeof(char), size, file); fclose(file); } +#endif // !ANGLE_ENABLE_WINDOWS_STORE #if defined(ANGLE_ENABLE_WINDOWS_STORE) @@ -568,4 +513,4 @@ void Sleep(unsigned long dwMilliseconds) WaitForSingleObjectEx(sleepEvent, dwMilliseconds, false); } -#endif +#endif // ANGLE_ENABLE_WINDOWS_STORE |