@gguf/claw
Version:
WhatsApp gateway CLI (Baileys web) with Pi RPC agent
15 lines (13 loc) • 363 B
text/typescript
import os from "node:os";
import path from "node:path";
export function resolveUserPath(input: string): string {
const trimmed = input.trim();
if (!trimmed) {
return trimmed;
}
if (trimmed.startsWith("~")) {
const expanded = trimmed.replace(/^~(?=$|[\\/])/, os.homedir());
return path.resolve(expanded);
}
return path.resolve(trimmed);
}