/**
* Copies the passed OS specific resource file to the target directory.
*
* @param string $os The OS we want to copy the files for
* @param string $resource The resource file we want to copy
* @param boolean $override TRUE if the file should be overwritten if exists, else FALSE
* @param integer $mode The mode of the target file
*
* @return void
*/
public static function copyOsSpecificResource($os, $resource, $override = false, $mode = 0644)
{
// we need the installation directory
$installDir = Setup::getValue(SetupKeys::INSTALL_DIR);
// prepare source and target directory
$source = Setup::prepareOsSpecificPath(sprintf('%s/resources/os-specific/%s/%s', $installDir, $os, $resource));
$target = Setup::prepareOsSpecificPath(sprintf('%s/%s', $installDir, $resource));
// query whether we've to override the file
if ($override === false && is_file($target) === true) {
return;
}
// prepare the target directory
Setup::prepareDirectory($target);
// copy the file to the target directory
copy($source, $target);
// set the correct mode for the file
Setup::changeFilePermissions($target, $mode);
}