目录

PathName

The path name that is used to get the path to specific directories using the app.getPath() method.

type PathName =
  'appResources' |
  'userData' |
  'userHome' |
  'localAppData' |
  'downloads';

Example 

import { app, PathName } from '@mobrowser/api';

const name: PathName = 'appResources'
const path = app.getPath(name)
console.log(path)

Types 

'appResources' 

The path to the app resources directory.

In the MoBrowser project, you can put images and other resources used by your application in the <PROJECT_ROOT>/assets/resources directory. During the build process, all the files and folders from this directory will be copied to the application bundle at the platform-specific location:

  • macOS: <APP_BUNDLE>/Contents/Resources
  • Windows: <APP_BUNDLE>/resources
  • Linux: <APP_BUNDLE>/resources

Use this path name to get an absolute path to the resources directory inside the application bundle on the current platform.

'userData' 

The path to the user data directory.

This is a directory where the application data such as cache, cookies, navigation history, GPU cache, local storage, visited links, web data, spell checking dictionary files, etc. are stored.

The directory is created automatically when the application is launched for the first time. The default location of the user data directory is different on each platform:

  • macOS: ~/Library/Application Support/<APP_NAME>
  • Windows: %LOCALAPPDATA%/<APP_NAME>
  • Linux: ~/.config/<APP_NAME>

'userHome' 

The path to the user home directory on the current platform.

'localAppData' 

The %LOCALAPPDATA% directory path on Windows.

'downloads' 

The path to the user’s downloads directory.