TagSpaces is an offline, open source, document manager with tagging support
fix watcher and cleanTrailingDirSeparator from path
sytolk27e179f7ab2b
diff --git a/src/main/main.ts b/src/main/main.tsindex 7b9595a74..14686600e 100644--- a/src/main/main.ts+++ b/src/main/main.ts@@ -110,6 +110,7 @@ const browserWindowOptions: BrowserWindowConstructorOptions = {autoHideMenuBar: true,titleBarStyle: isMacLike ? 'hidden' : 'default',webPreferences: {+ // webSecurity: !isDebug,spellcheck: true,preload:app.isPackaged || !isDebugdiff --git a/src/renderer/hooks/DirectoryContentContextProvider.tsx b/src/renderer/hooks/DirectoryContentContextProvider.tsxindex 89f9e161b..5c998b331 100644--- a/src/renderer/hooks/DirectoryContentContextProvider.tsx+++ b/src/renderer/hooks/DirectoryContentContextProvider.tsx@@ -33,6 +33,7 @@ import {import { TS } from '-/tagspaces.namespace';import { useTranslation } from 'react-i18next';import {+ cleanTrailingDirSeparator,extractContainingDirectoryPath,extractFileName,extractFileExtension,@@ -440,7 +441,11 @@ export const DirectoryContentContextProvider = ({' - currentLocationPath: ' +currentLocationPath.current,);- if (parentDirectory.includes(currentLocationPath.current)) {+ if (+ parentDirectory.includes(+ cleanTrailingDirSeparator(currentLocationPath.current),+ )+ ) {openDirectory(parentDirectory);} else {showNotification(t('core:parentDirNotInLocation'), 'warning', true);@@ -849,6 +854,7 @@ export const DirectoryContentContextProvider = ({(entry) => entry.path === path,);})+ .filter((i) => i > -1).sort((a, b) => b - a);/*const uniqueIndexes = indexes.filter(function (item, index) {diff --git a/src/renderer/hooks/FSWatcherContextProvider.tsx b/src/renderer/hooks/FSWatcherContextProvider.tsxindex dda84d740..4ac385a58 100644--- a/src/renderer/hooks/FSWatcherContextProvider.tsx+++ b/src/renderer/hooks/FSWatcherContextProvider.tsx@@ -67,7 +67,6 @@ export const FSWatcherContextProvider = ({currentDirectoryEntries,loadDirectoryContent,currentDirectoryPath,- currentLocationPath,currentDirectoryPerspective,addDirectoryEntries,removeDirectoryEntries,@@ -76,7 +75,7 @@ export const FSWatcherContextProvider = ({//const [watcher, setWatcher] = useState<FSWatcher>(undefined);const ignored = useRef<string[]>([]);const watchingFolderPath = useRef<string>(undefined);- const dispatch: AppDispatch = useDispatch();+ //const dispatch: AppDispatch = useDispatch();useEffect(() => {if (@@ -84,16 +83,16 @@ export const FSWatcherContextProvider = ({currentLocation.watchForChanges &¤tLocation.type !== locationType.TYPE_CLOUD) {- if (currentLocationPath.length > 0) {+ if (currentDirectoryPath && currentDirectoryPath.length > 0) {const depth =currentDirectoryPerspective === PerspectiveIDs.KANBAN ? 3 : 1;- watchFolder(currentLocationPath, depth);+ watchFolder(currentDirectoryPath, depth);}} else {stopWatching();}- }, [currentLocation, currentLocationPath]);+ }, [currentLocation, currentDirectoryPath]);/*useEffect(() => {// watchForEvents(listener);