(fromPath: string, toPath: string)
| 71 | } |
| 72 | |
| 73 | function relativeRawPath(fromPath: string, toPath: string): string { |
| 74 | if (fromPath === '/') { |
| 75 | return toPath.startsWith('/') ? toPath.slice(1) : toPath; |
| 76 | } |
| 77 | if (toPath === fromPath) { |
| 78 | return ''; |
| 79 | } |
| 80 | if (toPath.startsWith(`${fromPath}/`)) { |
| 81 | return toPath.slice(fromPath.length + 1); |
| 82 | } |
| 83 | return toPath; |
| 84 | } |
| 85 | |
| 86 | function appendDirectorySlash(name: string, hasChildren: boolean): string { |
| 87 | return hasChildren && !name.endsWith('/') ? `${name}/` : name; |