Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Create subfolder in relative path folder location (#1286)

Stanimir68097410f7a2
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index 80cce5fa5..069843d94 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -265,6 +265,13 @@ export default (state: any = initialState, action: any) => {
};
}
case types.LOAD_DIRECTORY_SUCCESS: {
+ let directoryPath;
+ if (action.directoryPath.startsWith('./')) {
+ // relative paths
+ directoryPath = PlatformIO.resolveFilePath(action.directoryPath);
+ } else {
+ ({ directoryPath } = action);
+ }
return {
...state,
currentDirectoryEntries: action.directoryContent,
@@ -274,7 +281,7 @@ export default (state: any = initialState, action: any) => {
currentDirectoryPerspective: action.directoryMeta
? action.directoryMeta.perspective
: undefined,
- currentDirectoryPath: action.directoryPath,
+ currentDirectoryPath: directoryPath,
isLoading: action.showIsLoading || false
};
}
diff --git a/app/services/electron-io.ts b/app/services/electron-io.ts
index 3d4078ad3..33cd11827 100644
--- a/app/services/electron-io.ts
+++ b/app/services/electron-io.ts
@@ -849,6 +849,8 @@ export default class ElectronIO {
this.electron.shell.openExternal(url);
};
+ resolveFilePath = (filePath: string): string => pathLib.resolve(filePath);
+
selectFileDialog = (): Promise<any> => {
const options = {
/* filters: [
diff --git a/app/services/platform-io.ts b/app/services/platform-io.ts
index dcea55324..f21133ad0 100644
--- a/app/services/platform-io.ts
+++ b/app/services/platform-io.ts
@@ -325,6 +325,9 @@ export default class PlatformIO {
static openFile = (filePath: string): void => nativeAPI.openFile(filePath);
+ static resolveFilePath = (filePath: string): string =>
+ objectStoreAPI ? filePath : nativeAPI.resolveFilePath(filePath);
+
static openUrl = (url: string): void => nativeAPI.openUrl(url);
static selectFileDialog = (): Promise<any> => nativeAPI.selectFileDialog();
diff --git a/app/services/webdav-io.ts b/app/services/webdav-io.ts
index 467d28d7c..e0c3b671a 100644
--- a/app/services/webdav-io.ts
+++ b/app/services/webdav-io.ts
@@ -727,6 +727,7 @@ export default class WebDAVIO {
window.open(url, '_blank');
};
+ resolveFilePath = (filePath: string): string => filePath;
/**
* Places the application window on top of the other windows
*/
diff --git a/tests/e2e/general.e2e.js b/tests/e2e/general.e2e.js
index fe3e6ec75..f1ae9c2d2 100644
--- a/tests/e2e/general.e2e.js
+++ b/tests/e2e/general.e2e.js
@@ -50,7 +50,7 @@ describe('TST51 - Perspective Grid [general]', () => {
await closeFileProperties();
});
- it('TST0501 - Create HTML file', async () => {
+ it('TST0501 - Create HTML file [electron]', async () => {
/*await createNewDirectory();
await reloadDirectory();
// await global.client.pause(500);
@@ -72,7 +72,7 @@ describe('TST51 - Perspective Grid [general]', () => {
await returnDirectoryBack();*/
// delete directory
- await deleteFirstFile();
+ // await deleteFirstFile();
await deleteDirectory(testFolder);
// await returnDirectoryBack();
await global.client.pause(500);
@@ -82,7 +82,7 @@ describe('TST51 - Perspective Grid [general]', () => {
);
});
- it('TST0502 - Create MD file', async () => {
+ it('TST0502 - Create MD file [electron]', async () => {
await createNewDirectory();
// await reloadDirectory();
// await global.client.pause(500);
@@ -95,7 +95,7 @@ describe('TST51 - Perspective Grid [general]', () => {
await expectElementExist(selectorFile, true);
await global.client.pause(500);
- await deleteFirstFile();
+ // await deleteFirstFile();
await deleteDirectory(testFolder);
await expectElementExist(
'[data-tid=fsEntryName_' + testFolder + ']',
@@ -103,7 +103,7 @@ describe('TST51 - Perspective Grid [general]', () => {
);
});
- it('TST0502 - Create TEXT file', async () => {
+ it('TST0502 - Create TEXT file [electron]', async () => {
await createNewDirectory();
// await reloadDirectory();
// await global.client.pause(500);
@@ -116,7 +116,7 @@ describe('TST51 - Perspective Grid [general]', () => {
await expectElementExist(selectorFile, true);
await global.client.pause(500);
- await deleteFirstFile();
+ // await deleteFirstFile();
await deleteDirectory(testFolder);
await expectElementExist(
'[data-tid=fsEntryName_' + testFolder + ']',