refactor: use PathProvider for user-data-dir and others (#29649)
* refactor: use PathProvider for user-data-dir and others * consolidate logic for DIR_RECENT and DIR_APP_LOGS into path provider * fix bad include * remove debugging code * fix build on mac * fix build on win * create app logs dir on both mac and non-mac
This commit is contained in:
parent
8b945cb296
commit
ebf54d7cc0
16 changed files with 115 additions and 108 deletions
|
@ -1,5 +1,4 @@
|
|||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
import { Menu } from 'electron/main';
|
||||
|
||||
|
@ -58,19 +57,6 @@ Object.defineProperty(app, 'applicationMenu', {
|
|||
// The native implementation is not provided on non-windows platforms
|
||||
app.setAppUserModelId = app.setAppUserModelId || (() => {});
|
||||
|
||||
app._setDefaultAppPaths = (packagePath) => {
|
||||
// Set the user path according to application's name.
|
||||
app.setPath('userData', path.join(app.getPath('appData'), app.name!));
|
||||
app.setPath('userCache', path.join(app.getPath('cache'), app.name!));
|
||||
app.setAppPath(packagePath);
|
||||
|
||||
// Add support for --user-data-dir=
|
||||
if (app.commandLine.hasSwitch('user-data-dir')) {
|
||||
const userDataDir = app.commandLine.getSwitchValue('user-data-dir');
|
||||
if (path.isAbsolute(userDataDir)) app.setPath('userData', userDataDir);
|
||||
}
|
||||
};
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
const setDockMenu = app.dock!.setMenu;
|
||||
app.dock!.setMenu = (menu) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue