Import apps/android/src/lib/workspace-path.ts

This commit is contained in:
QQ 2026-11-14 14:10:52 +08:00
parent fc740d5197
commit 1c4343844f
1 changed files with 8 additions and 0 deletions

View File

@ -0,0 +1,8 @@
export function workspaceParentPath(path: string): string {
const normalized = path.replace(/[\\/]+$/, '')
const segments = normalized.split(/[\\/]+/).filter(Boolean)
const parentSegments = segments.slice(0, -1)
if (parentSegments.length === 0) return normalized.startsWith('/') ? '/' : path
const rootPrefix = normalized.startsWith('/') ? '/' : ''
return `${rootPrefix}${parentSegments.join('/')}`
}