mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
11 lines
278 B
TypeScript
11 lines
278 B
TypeScript
export function joinPathSegments(a: string, b: string, separator: string): string {
|
|
/**
|
|
* The correct handling of cases when the first segment is a root (`/`, `C:/`) or UNC path (`//?/C:/`).
|
|
*/
|
|
if (a.endsWith(separator)) {
|
|
return a + b;
|
|
}
|
|
|
|
return a + separator + b;
|
|
}
|