feat: convert file manager into a plugin

This commit is contained in:
LukeGus committed 2026-09-23 16:27:29 -05:00
1 parent b76da9ab52
commit c85c1fdb86
259 files changed
+54155 -16791

No files matched your search

@@ -0,0 +1,26 @@
export function normalizeRemoteDir(remotePath: string): string {
const trimmed = remotePath.trim().replace(/\\/g, "/");
if (!trimmed) return "/";
const collapsed = trimmed.replace(/\/+/g, "/");
const absolute = collapsed.startsWith("/") ? collapsed : `/${collapsed}`;
if (absolute === "/") return "/";
return absolute.replace(/\/+$/, "");
}
export function joinRemotePath(basePath: string, childPath: string): string {
const base = normalizeRemoteDir(basePath);
const child = childPath.replace(/\\/g, "/").replace(/^\/+/, "");
if (!child) return base;
return base === "/" ? `/${child}` : `${base}/${child}`;
}
export function hasSameHostTransferConflict(
sourcePaths: string[],
destinationDir: string,
): boolean {
const dest = normalizeRemoteDir(destinationDir);
return sourcePaths.some((sourcePath) => {
const source = normalizeRemoteDir(sourcePath);
return dest === source || dest.startsWith(`${source}/`);
});
}