(path: string)
| 211 | }; |
| 212 | |
| 213 | const parsePath = (path: string) => { |
| 214 | if (!path) return []; |
| 215 | |
| 216 | const normalizedPath = path.replace(/\\/g, "/"); |
| 217 | const driveMatch = normalizedPath.match(/^([a-zA-Z]):/); |
| 218 | const driveLetter = driveMatch ? driveMatch[1] : ""; |
| 219 | const pathPart = driveLetter ? normalizedPath.slice(2) : normalizedPath; |
| 220 | |
| 221 | const parts = pathPart.split("/").filter(Boolean); |
| 222 | const result = driveLetter ? [driveLetter] : ["/"]; |
| 223 | |
| 224 | parts.forEach((_, index) => { |
| 225 | const _currentPath = "/" + parts.slice(0, index + 1).join("/"); |
| 226 | result.push(index < parts.length - 1 ? _currentPath + "/" : _currentPath); |
| 227 | }); |
| 228 | |
| 229 | return result; |
| 230 | }; |
| 231 | |
| 232 | const getLastNameFromPath = (path: string) => { |
| 233 | if (path === "/") return "/"; |
no test coverage detected