# util/FileUtils.php

## \FileUtils
jump to top

Package: phing\util

File utility class.

- handles os independent stuff etc
- mapper stuff
- filter stuff

Version
  $Revision: 781 $

### Methods

`contentEquals( $file1, $file2 ) : boolean`

Parameters

Name | Type | Description
--- | --- | ---
$file1 |  |
$file2 |  |

Returns

Type | Description
--- | ---
boolean | Whether contents of two files is the same.

`copyFile( \PhingFile $sourceFile, \PhingFile $destFile, boolean $overwrite = false, boolean $preserveLastModified = true, array $filterChains = null, \Project $project, integer $mode = 0755 ) : void`

Copies a file using filter chains.

Parameters

Name | Type | Description
--- | --- | ---
$sourceFile | \PhingFile |
$destFile | \PhingFile |
$overwrite | boolean |
$preserveLastModified | boolean |
$filterChains | array |
$project | \Project |
$mode | integer |

`getChainedReader( \Reader $in, array $filterChains, \Project $project ) : \Reader`
static

Returns a new Reader with filterchains applied. If filterchains are empty, simply returns passed reader.

Parameters

Name | Type | Description
--- | --- | ---
$in | \Reader | Reader to modify (if appropriate).
$filterChains | array | &$filterChains filter chains to apply.
$project | \Project |

Returns

Type | Description
--- | ---
\Reader | Assembled Reader (w/ filter chains).

`normalize( string $path ) : string`

Normalize the given absolute path.

This includes: - Uppercase the drive letter if there is one. - Remove redundant slashes after the drive spec. - resolve all ./, .\, ../ and ..\ sequences. - DOS style paths that start with a drive letter will have \ as the separator.

Parameters

Name | Type | Description
--- | --- | ---
$path | string | Path to normalize.

Returns

Type | Description
--- | ---
string |

`resolveFile( \$file $file, \$filename $filename ) : \PhingFile`

Interpret the filename as a file relative to the given file - unless the filename already represents an absolute filename.

Parameters

Name | Type | Description
--- | --- | ---
$file | \$file | the "reference" file for relative paths. This instance must be an absolute file and must not contain ./ or ../ sequences (same for \ instead of /).
$filename | \$filename | a file name

Returns

Type | Description
--- | ---
\PhingFile | A PhingFile object pointing to an absolute file that doesn't contain ./ or ../ sequences and uses the correct separator for the current platform.

Documentation was generated by DocBlox 0.17.1.