refactor: make app logs dir creation opt-in (#17841)
Previously, we were creating the app logs folder at a predefined location during initial electron startup, which meant that it had to be manually removed and prevented clean app portability. This refactors that implementation such that it's now an opt-in feature and developers must call app.setAppLogsPath(path) with an optional custom path in order to set this directory.
This commit is contained in:
parent
841e31b7e6
commit
0749dc4cc1
8 changed files with 76 additions and 31 deletions
|
@ -570,6 +570,14 @@ Hides all application windows without minimizing them.
|
|||
Shows application windows after they were hidden. Does not automatically focus
|
||||
them.
|
||||
|
||||
### `app.setAppLogsPath(path)`
|
||||
|
||||
* `path` String (optional) - A custom path for your logs. Must be absolute.
|
||||
|
||||
Sets or creates a directory your app's logs which can then be manipulated with `app.getPath()` or `app.setPath(newPath)`.
|
||||
|
||||
On _macOS_, this directory will be set by deafault to `/Library/Logs/YourAppName`, and on _Linux_ and _Windows_ it will be placed inside your `userData` directory.
|
||||
|
||||
### `app.getAppPath()`
|
||||
|
||||
Returns `String` - The current application directory.
|
||||
|
@ -618,8 +626,8 @@ Fetches a path's associated icon.
|
|||
|
||||
On _Windows_, there are 2 kinds of icons:
|
||||
|
||||
- Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
||||
- Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
||||
* Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
||||
* Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
||||
|
||||
On _Linux_ and _macOS_, icons depend on the application associated with file mime type.
|
||||
|
||||
|
@ -640,8 +648,8 @@ Fetches a path's associated icon.
|
|||
|
||||
On _Windows_, there a 2 kinds of icons:
|
||||
|
||||
- Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
||||
- Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
||||
* Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
|
||||
* Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
|
||||
|
||||
On _Linux_ and _macOS_, icons depend on the application associated with file mime type.
|
||||
|
||||
|
@ -694,6 +702,7 @@ To set the locale, you'll want to use a command line switch at app startup, whic
|
|||
**Note:** On Windows, you have to call it after the `ready` events gets emitted.
|
||||
|
||||
### `app.getLocaleCountryCode()`
|
||||
|
||||
Returns `string` - User operating system's locale two-letter [ISO 3166](https://www.iso.org/iso-3166-country-codes.html) country code. The value is taken from native OS APIs.
|
||||
|
||||
**Note:** When unable to detect locale country code, it returns empty string.
|
||||
|
@ -753,7 +762,6 @@ Returns `Boolean` - Whether the call succeeded.
|
|||
This method checks if the current executable as the default handler for a
|
||||
protocol (aka URI scheme). If so, it will remove the app as the default handler.
|
||||
|
||||
|
||||
### `app.isDefaultProtocolClient(protocol[, path, args])`
|
||||
|
||||
* `protocol` String - The name of your protocol, without `://`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue