/
GreyCat
/
openhuman
Обзор
Документация
Войти
/
GreyCat
/
openhuman
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
app/src/utils/pathUtils.ts
18 строк
660 B
oxoxDev
feat(intelligence): worktree isolation frontend + RPC wiring (#3376) (#3696)
16 июн 2026, 05:41
Не верифицирован
16 июн 2026, 05:41
bf6fd85
Код
Авторство
О чём код?
/** * Shared path-string helpers for display in the UI. * * These operate on plain strings (not the filesystem) so they work for both * POSIX and Windows-style paths surfaced by the Rust core. */ /** * Last path segment of a path string, for a compact label. * * Trims trailing slashes/backslashes, then returns everything after the final * `/` or `\`. Returns the (trimmed) input unchanged when it has no separator. */ export function basename(path: string): string { const trimmed = path.replace(/[/\\]+$/, ''); const idx = Math.max(trimmed.lastIndexOf('/'), trimmed.lastIndexOf('\\')); return idx >= 0 ? trimmed.slice(idx + 1) : trimmed; }