Utils_Windows.cpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <Utils/Utils.h>
  9. #include <AzCore/PlatformIncl.h>
  10. namespace AtomSampleViewer
  11. {
  12. namespace Utils
  13. {
  14. bool SupportsResizeClientArea()
  15. {
  16. return true;
  17. }
  18. AZStd::string GetDefaultDiffToolPath_Impl()
  19. {
  20. return AZStd::string("C:\\Program Files\\Beyond Compare 4\\BCompare.exe");
  21. }
  22. bool RunDiffTool_Impl(const AZStd::string& diffToolPath, const AZStd::string& filePathA, const AZStd::string& filePathB)
  23. {
  24. bool result = false;
  25. AZStd::wstring exeW;
  26. AZStd::to_wstring(exeW, diffToolPath.c_str());
  27. AZStd::wstring filePathAW;
  28. AZStd::to_wstring(filePathAW, filePathA.c_str());
  29. AZStd::wstring filePathBW;
  30. AZStd::to_wstring(filePathBW, filePathB.c_str());
  31. AZStd::wstring commandLineW = L"\"" + exeW + L"\" \"" + filePathAW + L"\" \"" + filePathBW + L"\"";
  32. STARTUPINFOW si;
  33. PROCESS_INFORMATION pi;
  34. ZeroMemory(&si, sizeof(si));
  35. si.cb = sizeof(si);
  36. ZeroMemory(&pi, sizeof(pi));
  37. // start the program up
  38. result = CreateProcessW(exeW.data(), // the path
  39. commandLineW.data(), // Command line
  40. NULL, // Process handle not inheritable
  41. NULL, // Thread handle not inheritable
  42. FALSE, // Set handle inheritance to FALSE
  43. 0, // No creation flags
  44. NULL, // Use parent's environment block
  45. NULL, // Use parent's starting directory
  46. &si, // Pointer to STARTUPINFO structure
  47. &pi // Pointer to PROCESS_INFORMATION structure (removed extra parentheses)
  48. );
  49. // Close process and thread handles.
  50. CloseHandle(pi.hProcess);
  51. CloseHandle(pi.hThread);
  52. return result;
  53. }
  54. } // namespace Utils
  55. } // namespace AtomSampleViewer