mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 11:16:39 +00:00
Mount source drive if automountOnFileSelect is set
Change-type: patch
This commit is contained in:
parent
c8737806c0
commit
e5ee0f1961
@ -18,8 +18,21 @@ import * as electron from 'electron';
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import * as errors from '../../../shared/errors';
|
import * as errors from '../../../shared/errors';
|
||||||
|
import * as settings from '../../../gui/app/models/settings';
|
||||||
import { SUPPORTED_EXTENSIONS } from '../../../shared/supported-formats';
|
import { SUPPORTED_EXTENSIONS } from '../../../shared/supported-formats';
|
||||||
|
|
||||||
|
async function mountSourceDrive() {
|
||||||
|
// sourceDrivePath is the name of the link in /dev/disk/by-path
|
||||||
|
const sourceDrivePath = await settings.get('automountOnFileSelect');
|
||||||
|
if (sourceDrivePath) {
|
||||||
|
try {
|
||||||
|
await electron.ipcRenderer.invoke('mount-drive', sourceDrivePath);
|
||||||
|
} catch (error) {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary Open an image selection dialog
|
* @summary Open an image selection dialog
|
||||||
*
|
*
|
||||||
@ -27,6 +40,7 @@ import { SUPPORTED_EXTENSIONS } from '../../../shared/supported-formats';
|
|||||||
* Notice that by image, we mean *.img/*.iso/*.zip/etc files.
|
* Notice that by image, we mean *.img/*.iso/*.zip/etc files.
|
||||||
*/
|
*/
|
||||||
export async function selectImage(): Promise<string | undefined> {
|
export async function selectImage(): Promise<string | undefined> {
|
||||||
|
await mountSourceDrive();
|
||||||
const options: electron.OpenDialogOptions = {
|
const options: electron.OpenDialogOptions = {
|
||||||
// This variable is set when running in GNU/Linux from
|
// This variable is set when running in GNU/Linux from
|
||||||
// inside an AppImage, and represents the working directory
|
// inside an AppImage, and represents the working directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user