TagSpaces is an offline, open source, document manager with tagging support
fix select file dialog
Ilian Sapundshiev575775f2c816
diff --git a/.eslintrc b/.eslintrcindex dce043ed5..76a8ee82f 100644--- a/.eslintrc+++ b/.eslintrc@@ -14,9 +14,9 @@"max-len": ["warn", { "code": 150 }],"react/jsx-indent": ["warn", 2],"arrow-parens": ["off"],- "compat/compat": "error","consistent-return": "off","comma-dangle": "off",+ "compat/compat": "warn","generator-star-spacing": "off","import/no-extraneous-dependencies": "off","import/no-unresolved": "off",diff --git a/app/services/electron-io.ts b/app/services/electron-io.tsindex 8ae468086..e5ce67ec3 100644--- a/app/services/electron-io.ts+++ b/app/services/electron-io.ts@@ -840,10 +840,21 @@ export default class ElectronIO {}] */};- return new Promise(resolve => {- this.remote.dialog.showOpenDialog(options, fileNames => {- resolve(fileNames);- });+ return new Promise((resolve, reject) => {+ this.remote.dialog+ .showOpenDialog(options)+ .then(resultObject => {+ if (resultObject.filePaths && resultObject.filePaths.length) {+ // alert(JSON.stringify(resultObject.filePaths));+ resolve(resultObject.filePaths);+ } else {+ reject('No file selected');+ }+ return true;+ })+ .catch(e => {+ reject('Error opening file ' + e);+ });});};@@ -851,14 +862,13 @@ export default class ElectronIO {const options = {properties: ['openDirectory', 'createDirectory']};- // eslint-disable-next-line compat/compatreturn new Promise((resolve, reject) => {this.remote.dialog.showOpenDialog(options)- .then(directory => {- if (directory.filePaths && directory.filePaths.length) {- // alert(JSON.stringify(directory.filePaths));- resolve(directory.filePaths);+ .then(resultObject => {+ if (resultObject.filePaths && resultObject.filePaths.length) {+ // alert(JSON.stringify(resultObject.filePaths));+ resolve(resultObject.filePaths);} else {reject('No directory selected');}