-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from divyenduz/fix_symlinks_and_links
fix: symlinks and links
- Loading branch information
Showing
13 changed files
with
296 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import { SQLiteBackend } from "@zoid-fs/sqlite-backend"; | ||
import { MountOptions } from "@zoid-fs/node-fuse-bindings"; | ||
import { symlink } from "./symlink"; | ||
import fuse, { MountOptions } from "@zoid-fs/node-fuse-bindings"; | ||
import { match } from "ts-pattern"; | ||
|
||
export const link: (backend: SQLiteBackend) => MountOptions["link"] = ( | ||
backend | ||
) => { | ||
return async (src, dest, cb) => { | ||
console.log("link(%s, %s)", src, dest); | ||
//@ts-expect-error fix types | ||
// TODO: implement link properly | ||
symlink(backend)(src, dest, cb); | ||
return async (srcPath, destPath, cb) => { | ||
console.info("link(%s, %s)", srcPath, destPath); | ||
|
||
// TODO: throw if destination doesn't exist | ||
|
||
// TODO: double check if mode for link is correct | ||
// https://unix.stackexchange.com/questions/193465/what-file-mode-is-a-link | ||
const r = await backend.createLink(srcPath, destPath); | ||
match(r) | ||
.with({ status: "ok" }, () => { | ||
cb(0); | ||
}) | ||
.with({ status: "not_found" }, () => { | ||
cb(fuse.ENOENT); | ||
}) | ||
.exhaustive(); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.