Import apps/android/src/lib/workspace-path.ts
This commit is contained in:
parent
fc740d5197
commit
1c4343844f
|
|
@ -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('/')}`
|
||||
}
|
||||
Loading…
Reference in New Issue