Skip to content

Commit 5267333

Browse files
committed
Fix: cp recrusive
1 parent c9247ed commit 5267333

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

src/helper.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import joplin from "api";
22
import * as path from "path";
33
import { exec } from "child_process";
44
import { promisify } from "util";
5-
import { copyFileSync} from "fs-extra";
6-
import { moveSync} from "fs-extra";
5+
import { copyFileSync } from "fs-extra";
6+
import { moveSync } from "fs-extra";
77

88
export namespace helper {
99
export async function validFileName(fileName: string) {
@@ -97,20 +97,29 @@ export namespace helper {
9797

9898
// Workaround for "ENOTSUP: operation not supported on socket" #98
9999
// https://github.com/JackGruber/joplin-plugin-backup/issues/98
100-
export async function WorkaroundCopyFile(src: string, dst: string, fsWorkaroundLinux: boolean): Promise<boolean> {
100+
export async function WorkaroundCopyFile(
101+
src: string,
102+
dst: string,
103+
fsWorkaroundLinux: boolean
104+
): Promise<boolean> {
101105
if (process.platform == "linux" && fsWorkaroundLinux === true) {
102106
var execPromise = promisify(exec);
103-
await execPromise(`cp '${src}' '${dst}'`);
107+
await execPromise(`cp -r '${src}' '${dst}'`);
104108
} else {
105109
copyFileSync(src, dst);
106110
}
107111

108-
return true
112+
return true;
109113
}
110114

111115
// Workaround for "ENOTSUP: operation not supported on socket" #98
112116
// https://github.com/JackGruber/joplin-plugin-backup/issues/98
113-
export async function WorkaroundMove(src: string, dst: string, fsWorkaroundLinux: boolean, overwrite: boolean = false): Promise<boolean> {
117+
export async function WorkaroundMove(
118+
src: string,
119+
dst: string,
120+
fsWorkaroundLinux: boolean,
121+
overwrite: boolean = false
122+
): Promise<boolean> {
114123
if (process.platform == "linux" && fsWorkaroundLinux === true) {
115124
var execPromise = promisify(exec);
116125
await execPromise(`mv '${src}' '${dst}'`);
@@ -120,6 +129,6 @@ export namespace helper {
120129
});
121130
}
122131

123-
return true
132+
return true;
124133
}
125134
}

0 commit comments

Comments
 (0)