Determines whether a path contains invalid characters.
npx atmx add helper is-path-valid
Copy and paste the following method into @/utils/helpers/undefined.ts:
@/utils/helpers/undefined.ts
import { parse } from "node:path"; /*** Determines whether a path contains invalid characters.** @param path - The path to check.* @returns*/export function isPathValid(path: string): boolean {if (process.platform === "win32") {const pathHasInvalidWinCharacters = /[<>:"|?*]/.test( path.replace(parse(path).root, ""),); if (pathHasInvalidWinCharacters) { const error = new Error(`Path contains invalid characters: ${path}`); (error as any).code = "EINVAL"; return false;}} return true;}