import * as OrigPath from 'path' ; const redirectedPath = OrigPath . posix ; /**
 * Works only on unix style paths regardless on which operating system
 * DeZog is running on.
 * Unix style path (i.e. forward slashes) are recognized by Windows as well.
 * So it is still compatible.
 * Does not provide all functionality of 'path'
 * only the used functions.
 * Use this class everywhere instead of path directly.
 */ export class UnifiedPath { public static basename = redirectedPath . basename ; public static dirname = redirectedPath . dirname ; public static resolve = redirectedPath . resolve ; /**
     * Needs to check posix and windows.
     * Required because a path could now start with "c:/..." instead of "/".
     */ public static isAbsolute ( path ) { if ( OrigPath . posix . isAbsolute ( path ) ) return true ; if ( OrigPath . win32 . isAbsolute ( path ) ) return true ; return false ; } /**
     * Like 'join' but afterwards converts to unified path.
     */ public static join ( ... paths ) { const s = redirectedPath . join ( ... paths ) ; return this . getUnifiedPath ( s ) ; } param fpath return public static getUnifiedPath ( fpath ) { if ( ! fpath ) return undefined as any ; let uPath = fpath . replace ( /\\/g , '/' ) ; if ( uPath . length > 1 ) { let drive = uPath . substring ( 0 , 2 ) ; if ( drive . endsWith ( ':' ) ) { drive = drive . toLowerCase ( ) ; uPath = drive + uPath . substring ( 2 ) ; } } return uPath ; } param fpaths return public static getUnifiedPathArray ( fpaths ) { if ( ! fpaths ) return undefined as any ; const uPath = fpaths . map ( fpath => ( ( fpath != undefined ) ? fpath . replace ( /\\/g , '/' ) : undefined ) as string ) ; return uPath ; } }