MCPcopy
hub / github.com/coder/mux / getSiblingDirectoryPrefix

Function getSiblingDirectoryPrefix

src/node/runtime/atomicWriteTempPath.ts:3–10  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

1import * as crypto from "crypto";
2
3function getSiblingDirectoryPrefix(filePath: string): string {
4 const lastSeparatorIndex = Math.max(filePath.lastIndexOf("/"), filePath.lastIndexOf("\\"));
5 if (lastSeparatorIndex === -1) {
6 return "";
7 }
8
9 return filePath.slice(0, lastSeparatorIndex + 1);
10}
11
12/**
13 * Use a short, collision-proof sibling temp path so concurrent writers never

Callers 1

getAtomicWriteTempPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected