mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-04-13 04:18:44 +00:00
Add self-hosted-livesync-cli to src/apps/cli as a headless, and a dedicated version.
This commit is contained in:
18
src/apps/cli/adapters/NodePathAdapter.ts
Normal file
18
src/apps/cli/adapters/NodePathAdapter.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import * as path from "path";
|
||||
import type { FilePath } from "@lib/common/types";
|
||||
import type { IPathAdapter } from "@lib/serviceModules/adapters";
|
||||
import type { NodeFile } from "./NodeTypes";
|
||||
|
||||
/**
|
||||
* Path adapter implementation for Node.js
|
||||
*/
|
||||
export class NodePathAdapter implements IPathAdapter<NodeFile> {
|
||||
getPath(file: string | NodeFile): FilePath {
|
||||
return (typeof file === "string" ? file : file.path) as FilePath;
|
||||
}
|
||||
|
||||
normalisePath(p: string): string {
|
||||
// Normalize path separators to forward slashes (like Obsidian)
|
||||
return path.normalize(p).replace(/\\/g, "/");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user