Squashed commit of sync hidden files:

commit 73967756d51d246b3ca203aa3683cdfebf567000
Author: fyears <1142836+fyears@users.noreply.github.com>
Date:   Sun Mar 13 22:41:28 2022 +0800

    fix typo

commit 08e16faa9a9ace9bec71acb723e0d70ca361d49f
Author: fyears <1142836+fyears@users.noreply.github.com>
Date:   Sun Mar 13 22:41:01 2022 +0800

    add modal in settings

commit 9db7194fa28cb62b1fa4c01ac7f746d5ac3b86a8
Author: fyears <1142836+fyears@users.noreply.github.com>
Date:   Sun Mar 13 22:03:00 2022 +0800

    working sync for .obsidian and _

commit 4be24ba092181c1c3e1aabe5e9d4e9fcff28f987
Author: fyears <1142836+fyears@users.noreply.github.com>
Date:   Sun Mar 13 16:07:10 2022 +0800

    more logic for hidden path
This commit is contained in:
fyears
2022-03-13 22:42:16 +08:00
parent 0b5b9cf51a
commit af93af9047
8 changed files with 380 additions and 38 deletions
+12 -4
View File
@@ -10,10 +10,18 @@ const log = origLog.getLogger("rs-default");
/**
* If any part of the file starts with '.' or '_' then it's a hidden file.
* @param item
* @param loose
* @param dot
* @param underscore
* @returns
*/
export const isHiddenPath = (item: string, loose: boolean = true) => {
export const isHiddenPath = (
item: string,
dot: boolean = true,
underscore: boolean = true
) => {
if (!(dot || underscore)) {
throw Error("parameter error for isHiddenPath");
}
const k = path.posix.normalize(item); // TODO: only unix path now
const k2 = k.split("/"); // TODO: only unix path now
// log.info(k2)
@@ -21,10 +29,10 @@ export const isHiddenPath = (item: string, loose: boolean = true) => {
if (singlePart === "." || singlePart === ".." || singlePart === "") {
continue;
}
if (singlePart[0] === ".") {
if (dot && singlePart[0] === ".") {
return true;
}
if (loose && singlePart[0] === "_") {
if (underscore && singlePart[0] === "_") {
return true;
}
}