TagSpaces is an offline, open source, document manager with tagging support
polish: improving opening files from command line and history support
Ilian Sapundshievd4582bf19a49
diff --git a/app/containers/Root.tsx b/app/containers/Root.tsxindex ba3d0bed5..37417267a 100644--- a/app/containers/Root.tsx+++ b/app/containers/Root.tsx@@ -33,7 +33,6 @@ import { getDefaultLocationId } from '-/reducers/locations';import PlatformIO from '../services/platform-io';// import MainPage from './MainPage';import { getURLParameter } from '-/utils/misc';-import { FileSystemEntry, getAllPropertiesPromise } from '-/services/utils-io';type RootType = {store: {};@@ -65,27 +64,21 @@ function onBeforeLift(store) {store.dispatch(SettingsActions.setLanguage(langURLParam));}- const openParam = getURLParameter('open');- const locationIdParam = getURLParameter('lid');- if (openParam && openParam.length > 1) {- // dispatch toggle full width+ const lid = getURLParameter('tslid');+ const dPath = getURLParameter('tsdpath');+ const ePath = getURLParameter('tsepath');+ const cmdOpen = getURLParameter('cmdopen');+ if (lid || dPath || ePath) {setTimeout(() => {- getAllPropertiesPromise(decodeURIComponent(openParam))- .then((fsEntry: FileSystemEntry) => {- if (fsEntry.isFile) {- store.dispatch(AppActions.openFsEntry(fsEntry));- } else {- store.dispatch(AppActions.loadDirectoryContent(fsEntry.path));- }- return true;- })- .catch(error =>- console.warn(- 'Error getting properties for entry: ' + openParam + ' - ' + error- )- );- // store.dispatch(AppActions.openFile(decodeURIComponent(openParam)));- store.dispatch(AppActions.setEntryFullWidth(true));+ store.dispatch(AppActions.openLink(window.location.href));+ }, 1000);+ } else if (cmdOpen) {+ setTimeout(() => {+ store.dispatch(+ AppActions.openLink(+ window.location.href.split('?')[0] + '?cmdopen=' + cmdOpen+ )+ );}, 1000);}}diff --git a/app/main.dev.ts b/app/main.dev.tsindex 57292d31d..7813a757c 100644--- a/app/main.dev.ts+++ b/app/main.dev.ts@@ -147,9 +147,9 @@ app.on('ready', async () => {if (startupFilePath) {if (startupFilePath.startsWith('./') || startupFilePath.startsWith('.\\')) {startupParameter =- '?open=' + encodeURIComponent(path.join(__dirname, startupFilePath));+ '?cmdopen=' + encodeURIComponent(path.join(__dirname, startupFilePath));} else {- startupParameter = '?open=' + encodeURIComponent(startupFilePath);+ startupParameter = '?cmdopen=' + encodeURIComponent(startupFilePath);}}