(str: string)
| 27 | Buffer.from(str).length + SPACE_FOR_APPENDING > MAX_PATH_SEGMENT_BYTES; |
| 28 | |
| 29 | export function shortName(str: string): string { |
| 30 | if (isMacOs() || isWindows()) { |
| 31 | const overflowingChars = str.length - MAX_PATH_SEGMENT_CHARS; |
| 32 | return str.slice( |
| 33 | 0, |
| 34 | str.length - overflowingChars - SPACE_FOR_APPENDING - 1, |
| 35 | ); |
| 36 | } |
| 37 | const strBuffer = Buffer.from(str); |
| 38 | const overflowingBytes = |
| 39 | Buffer.byteLength(strBuffer) - MAX_PATH_SEGMENT_BYTES; |
| 40 | return strBuffer |
| 41 | .slice( |
| 42 | 0, |
| 43 | Buffer.byteLength(strBuffer) - overflowingBytes - SPACE_FOR_APPENDING - 1, |
| 44 | ) |
| 45 | .toString(); |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * Convert Windows backslash paths to posix style paths. |
no test coverage detected
searching dependent graphs…