mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: Use DIR_ASSETS path to locate resource bundles (#47950)
* feat: Use DIR_ASSETS path to locate resource bundles Co-authored-by: Will Anderson <andersonw@dropbox.com> * Use DIR_ASSETS for calculating ASAR relative paths Co-authored-by: Will Anderson <andersonw@dropbox.com> * Add test to verify 'assets' matches parent dir of 'exe' Co-authored-by: Will Anderson <andersonw@dropbox.com> * Add Mac-specific test for assets path (but it is failing) Co-authored-by: Will Anderson <andersonw@dropbox.com> * test: Update app.getPath('assets') to expect an exception on Mac Co-authored-by: Will Anderson <andersonw@dropbox.com> * docs: Update docs for 'assets' path to indicate that it's only available on Windows + Linux Co-authored-by: Will Anderson <andersonw@dropbox.com> * fix: Don't define 'assets' mapping on macOS Co-authored-by: Will Anderson <andersonw@dropbox.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Will Anderson <andersonw@dropbox.com>
This commit is contained in:
@@ -456,11 +456,10 @@ base::FilePath GetResourcesPath() {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
return MainApplicationBundlePath().Append("Contents").Append("Resources");
|
||||
#else
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
base::FilePath exec_path(command_line->GetProgram());
|
||||
base::PathService::Get(base::FILE_EXE, &exec_path);
|
||||
base::FilePath assets_path;
|
||||
base::PathService::Get(base::DIR_ASSETS, &assets_path);
|
||||
|
||||
return exec_path.DirName().Append(FILE_PATH_LITERAL("resources"));
|
||||
return assets_path.Append(FILE_PATH_LITERAL("resources"));
|
||||
#endif
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Reference in New Issue
Block a user