2022-08-03 02:51:02 +02:00
|
|
|
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
|
|
|
#include "tests/shared/browser/resource_util.h"
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include "include/internal/cef_string_wrappers.h"
|
|
|
|
|
|
|
|
namespace client {
|
|
|
|
|
|
|
|
bool GetResourceDir(std::string& dir) {
|
|
|
|
wchar_t buff[MAX_PATH];
|
|
|
|
|
|
|
|
// Retrieve the executable path.
|
|
|
|
auto len = GetModuleFileName(nullptr, buff, MAX_PATH);
|
2023-01-02 23:59:03 +01:00
|
|
|
if (len == 0) {
|
2022-08-03 02:51:02 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2022-08-03 02:51:02 +02:00
|
|
|
|
|
|
|
buff[len] = 0;
|
|
|
|
|
|
|
|
// Remove the executable name from the path.
|
|
|
|
auto* pos = wcsrchr(buff, L'\\');
|
2023-01-02 23:59:03 +01:00
|
|
|
if (!pos) {
|
2022-08-03 02:51:02 +02:00
|
|
|
return false;
|
2023-01-02 23:59:03 +01:00
|
|
|
}
|
2022-08-03 02:51:02 +02:00
|
|
|
|
|
|
|
// Add "ceftests_files" to the path.
|
|
|
|
wcscpy(pos + 1, L"ceftests_files");
|
|
|
|
dir = CefStringWide(buff).ToString();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace client
|