Archipelago — open-source initial import

This commit is contained in:
Archipelago
2026-08-12 10:55:49 +00:00
commit 624a2418ed
1578 changed files with 333060 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
export function normalizeCloudPath(path: unknown, fallback = '/'): string {
if (typeof path !== 'string' || !path.trim()) return fallback
const trimmed = path.trim()
const withSlash = trimmed.startsWith('/') ? trimmed : `/${trimmed}`
return withSlash.replace(/\/+/g, '/')
}
export function parentCloudPath(path: string): string {
const normalized = normalizeCloudPath(path)
if (normalized === '/') return '/'
const parent = normalized.slice(0, normalized.lastIndexOf('/')) || '/'
return parent
}