import path from "node:path"; import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
const NOT_FOUND_CODES = new Set(["ENOENT", "ENOTDIR"]); const SYMLINK_OPEN_CODES = new Set(["ELOOP", "EINVAL", "ENOTSUP"]); const PARENT_SEGMENT_PREFIX = /^\.\.(?:[\\/]|$)/u;
export function normalizeWindowsPathForComparison(input: string): string {
let normalized = path.win32.normalize(input); if (normalized.startsWith("\\\\?\\")) {
normalized = normalized.slice(4); if (normalized.toUpperCase().startsWith("UNC\\")) {
normalized = `\\\\${normalized.slice(4)}`;
}
} return normalizeLowercaseStringOrEmpty(normalized.replaceAll("/", "\\"));
}
export function isNodeError(value: unknown): value is NodeJS.ErrnoException { returnBoolean(
value && typeof value === "object" && "code" in (value as Record<string, unknown>),
);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.