- Qbs Manual
- FileInfo Service
- Qt Build Suite 1.4.3

# FileInfo Service

The `FileInfo` service offers various operations on file paths, such as turning absolute paths into relative ones, splitting a path into its components, and so on.

## Available Operations

### baseName

    FileInfo.baseName(filePath: string): string

Returns the file name of `filePath` up to (but not including) the first '.' character.

### completeBaseName

    FileInfo.completeBaseName(filePath: string): string

Returns the file name of `filePath` up to (but not including) the last '.' character.

### fileName

    FileInfo.fileName(filePath: string): string

Returns the last component of `filePath`, that is, everything after the last '/' character.

### fromWindowsSeparators

    FileInfo.fromWindowsSeparators(filePath: string): string

Returns `filePath` with all '\' characters replaced by '/'.

### isAbsolutePath

    FileInfo.isAbsolutePath(filePath: string): boolean

Returns true if `filePath` is an absolute path and false if it is a relative one.

### joinPaths

    FileInfo.joinPaths(...paths: string[]): string

Concatenates the given paths using the '/' character.

### path

    FileInfo.path(filePath: string): string

Returns the part of `filePath` that is not the file name, that is, everything up to (but not including) the last '/' character. If `filePath` is just a file name, then '.' is returned. If `filePath` ends with a '/' character, then the file name is assumed to be empty for the purpose of the above definition.

### relativePath

    FileInfo.relativePath(dirPath: string, filePath: string): string

Returns a relative path so that joining `dirPath` and the returned path results in `filePath`. If necessary, '..' components are inserted. The function assumes `dirPath` and `filePath` to be absolute paths and `dirPath` to be a directory.

### toWindowsSeparators

    FileInfo.toWindowsSeparators(filePath: string): string

Returns `filePath` with all '/' characters replaced by '\'.