Replace hard-coded directory separators constant

This removes warnings when building the manifest cache in Windows environments.
This commit is contained in:
Christopher Pitt 2016-11-24 08:05:56 +13:00 committed by GitHub
parent 67496d3eb0
commit 06d1297fbe

View File

@ -12,7 +12,7 @@ class ManifestCache_File implements ManifestCache
function __construct($name) function __construct($name)
{ {
$this->folder = TEMP_FOLDER . '/' . $name; $this->folder = TEMP_FOLDER . DIRECTORY_SEPARATOR . $name;
if (!is_dir($this->folder)) { if (!is_dir($this->folder)) {
mkdir($this->folder); mkdir($this->folder);
} }
@ -20,18 +20,18 @@ class ManifestCache_File implements ManifestCache
function load($key) function load($key)
{ {
$file = $this->folder . '/cache_' . $key; $file = $this->folder . DIRECTORY_SEPARATOR . 'cache_' . $key;
return file_exists($file) ? unserialize(file_get_contents($file)) : null; return file_exists($file) ? unserialize(file_get_contents($file)) : null;
} }
function save($data, $key) function save($data, $key)
{ {
$file = $this->folder . '/cache_' . $key; $file = $this->folder . DIRECTORY_SEPARATOR . 'cache_' . $key;
file_put_contents($file, serialize($data)); file_put_contents($file, serialize($data));
} }
function clear() function clear()
{ {
array_map('unlink', glob($this->folder . '/cache_*')); array_map('unlink', glob($this->folder . DIRECTORY_SEPARATOR . 'cache_*'));
} }
} }