-
Notifications
You must be signed in to change notification settings - Fork 16.2k
feat: Use DIR_ASSETS path to locate resource bundles #47439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Use DIR_ASSETS path to locate resource bundles #47439
Conversation
@@ -616,7 +617,7 @@ Returns `string` - The current application directory. | |||
directory. | |||
* `temp` Temporary directory. | |||
* `exe` The current executable file. | |||
* `module` The `libchromiumcontent` library. | |||
* `module` The location of the Chromium module. By default this is synonymous with `exe`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only tangentially related to the other changes, but libchromiumcontent
hasn't existed for a long time, so it seemed worth updating these docs while I'm here.
This looks good, can you make the following additional changes
|
@deepak1556 I started working on this but then got pulled into other work for awhile. What I've found by adding some tests is that |
Thanks for looking into the tests, if it would make things easier, we can expose the My initial comment for tests was also specific to windows and linux since the code paths touched in this PR are specific to those platforms. |
Description of Change
Electron currently uses the
DIR_MODULE
constantsDIR_EXE
when querying thePathService
to calculate resource paths, but the Chromium source and https://issues.chromium.org/issues/40203062 both discourage using these constants to locate assets, and instead recommend usingDIR_ASSETS
.By default
DIR_ASSETS
is an alias forDIR_MODULE
, but by updating Electron to useDIR_ASSETS
, we align better with Chromium recommendations, and make it possible for apps with custom layouts to only need to overrideDIR_ASSETS
.In addition to changing the constants used internally for loading
resources.pak
and for theprocess.resourcesPath
, this PR adds "assets" as a key that can be queried viaapp.getPath
.Because
DIR_ASSETS
is treated as an alias forDIR_MODULE
by default, these changes should be a no-op for any existing apps.Checklist
npm test
passesRelease Notes
Notes: Internally switched to using
DIR_ASSETS
instead ofDIR_MODULE
/DIR_EXE
to locate assets and resources, and added "assets" as a key that can be queried viaapp.getPath
.