import * as glob from "glob-promise" ; import * as path from "path" ; import * as files from "." ; /** represents the document base directory */ export class SourceDir { value : string ; constructor ( value ) { this . value = value ; } async fullFilesMatchingGlob ( expression ) { const allFiles = await glob ( expression ) ; return allFiles . sort ( ) . map ( file => new files . AbsoluteFilePath ( file ) . toFullFile ( this ) ) ; } joinFullDir ( dir ) { return new files . AbsoluteDirPath ( path . join ( this . platformified ( ) , dir . platformified ( ) ) ) ; } joinFullFile ( file ) { return new files . AbsoluteFilePath ( path . join ( this . platformified ( ) , file . platformified ( ) ) ) ; } /** provides a path of this directory with the given path appended */ joinStr ( ... paths ) { return path . join ( this . platformified ( ) , ... paths ) ; } /**
     * Returns the path in the platform-specific format,
     * i.e. using '\' on Windows and '/' everywhere else
     */ platformified ( ) { return this . value . replace ( /\//g , path . sep ) ; } /** Returns this absolute path using forward slashes as path separators */ unixified ( ) { return this . value ; } }