зеркало из https://github.com/electron/electron.git
load all pak files on macOS
This commit is contained in:
Родитель
a11182ca84
Коммит
18dde0a0bd
|
@ -7,6 +7,7 @@
|
|||
#include <memory>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/path_service.h"
|
||||
#include "brightray/browser/browser_client.h"
|
||||
#include "brightray/common/content_client.h"
|
||||
|
@ -53,12 +54,13 @@ void LoadResourceBundle(const std::string& locale) {
|
|||
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
|
||||
bundle.ReloadLocaleResources(locale);
|
||||
|
||||
// Load other resource files.
|
||||
#if defined(OS_MACOSX)
|
||||
LoadCommonResources();
|
||||
#else
|
||||
// Load other resource files.
|
||||
base::FilePath pak_dir;
|
||||
#if defined(OS_MACOSX)
|
||||
pak_dir = base::mac::FrameworkBundlePath().Append("Resources");
|
||||
#else
|
||||
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||
#endif
|
||||
bundle.AddDataPackFromPath(
|
||||
pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")),
|
||||
ui::GetSupportedScaleFactors()[0]);
|
||||
|
@ -79,7 +81,6 @@ void LoadResourceBundle(const std::string& locale) {
|
|||
bundle.AddDataPackFromPath(
|
||||
pak_dir.Append(FILE_PATH_LITERAL("views_resources_200_percent.pak")),
|
||||
ui::SCALE_FACTOR_200P);
|
||||
#endif
|
||||
}
|
||||
|
||||
MainDelegate::MainDelegate() {}
|
||||
|
|
|
@ -25,23 +25,8 @@ base::FilePath GetFrameworksPath() {
|
|||
return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
|
||||
}
|
||||
|
||||
base::FilePath GetResourcesPakFilePath(NSString* name) {
|
||||
auto path = [base::mac::FrameworkBundle() pathForResource:name ofType:@"pak"];
|
||||
return base::mac::NSStringToFilePath(path);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void LoadCommonResources() {
|
||||
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
|
||||
bundle.AddDataPackFromPath(GetResourcesPakFilePath(@"content_shell"),
|
||||
ui::GetSupportedScaleFactors()[0]);
|
||||
#if defined(ENABLE_PDF_VIEWER)
|
||||
bundle.AddDataPackFromPath(GetResourcesPakFilePath(@"pdf_viewer_resources"),
|
||||
ui::GetSupportedScaleFactors()[0]);
|
||||
#endif // defined(ENABLE_PDF_VIEWER)
|
||||
}
|
||||
|
||||
void MainDelegate::OverrideFrameworkBundlePath() {
|
||||
base::FilePath helper_path =
|
||||
GetFrameworksPath().Append(GetApplicationName() + " Framework.framework");
|
||||
|
|
|
@ -638,8 +638,12 @@
|
|||
'mac_bundle': 1,
|
||||
'mac_bundle_resources': [
|
||||
'atom/common/resources/mac/MainMenu.xib',
|
||||
'<(libchromiumcontent_dir)/content_shell.pak',
|
||||
'<(libchromiumcontent_dir)/icudtl.dat',
|
||||
'<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/content_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/content_shell.pak',
|
||||
'<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/views_resources_200_percent.pak',
|
||||
'<(libchromiumcontent_dir)/natives_blob.bin',
|
||||
'<(libchromiumcontent_dir)/snapshot_blob.bin',
|
||||
],
|
||||
|
|
Загрузка…
Ссылка в новой задаче