new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

app/filesystem

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

app.isInApplicationsFolder() method macOS

Returns a boolean indicating whether the application is currently running from the system's Application folder. Use in combination with app.moveToApplicationsFolder().

app.moveToApplicationsFolder(options) method macOS

The app.moveToApplicationsFolder([options]) method moves the app to the Applications folder and returns a boolean indicating whether the move was successful. If successful, the application will quit and relaunch. The optional options object accepts a conflictHandler function with parameter conflictType (string, can be 'exists' meaning an app with same name is in Applications directory, or 'existsAndRunning' meaning it exists and is running). The conflictHandler returns a boolean: returning false ensures no further action is taken, returning true results in default behavior and method continues. No confirmation dialog is presented by default. This method throws errors if anything other than the user causes the move to fail, such as authorization cancellation returning false.

app.moveToApplicationsFolder() default behavior with conflicts

By default, if an app with the same name exists in the Applications directory and is not running, the existing app will be trashed and the active app moved into its place. If the existing app is running, the preexisting running app will assume focus and the previously active app will quit itself.

app.moveToApplicationsFolder() example with conflict handler

Example code showing how to use moveToApplicationsFolder with a conflict handler: const { app, dialog } = require('electron') app.moveToApplicationsFolder({ conflictHandler: (conflictType) => { if (conflictType === 'exists') { return dialog.showMessageBoxSync({ type: 'question', buttons: ['Halt Move', 'Continue Move'], defaultId: 0, message: 'An app of this name already exists' }) === 1 } } })

Crash reports storage directory

Crash reports are stored temporarily before being uploaded in a directory underneath the app's user data directory, called 'Crashpad'. This directory can be overridden by calling app.setPath('crashDumps', '/path/to/crashes') before starting the crash reporter.

FileFilter object structure

The FileFilter object has two properties: name (string) and extensions (string array). The name property is a string identifier for the filter, and the extensions property is an array of file extensions.

Give your agent this brain