Commit 8b0737fd authored by Melissa Draper's avatar Melissa Draper

Replace DIRECTORY_SEPERATOR with / for windows compatability

bug #643503

Change-Id: I74bb2e6a5e431103d40561baea39914346e5f7a6
Signed-off-by: default avatarMelissa Draper <melissa@catalyst.net.nz>
parent 7a121df6
......@@ -231,7 +231,7 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
$importer->trace($blogpostlink);
$pathname = urldecode((string)$blogpostlink['href']);
$dir = dirname($importer->get('filename'));
$pathname = $dir . DIRECTORY_SEPARATOR . $pathname;
$pathname = $dir . '/' . $pathname;
if (!file_exists($pathname)) {
return false;
}
......
......@@ -276,7 +276,7 @@ class LeapImportFile extends LeapImportArtefactPlugin {
$data->parent = $parent;
}
$pathname = $dir . DIRECTORY_SEPARATOR . $pathname;
$pathname = $dir . '/' . $pathname;
// This API sucks, but that's not my problem
if (!$id = ArtefactTypeFile::save_file($pathname, $data, $importer->get('usrobj'), true)) {
......
......@@ -69,7 +69,7 @@ $CFG = (object)array_merge((array)$cfg, (array)$CFG);
// Fix up paths in $CFG
foreach (array('docroot', 'dataroot') as $path) {
$CFG->{$path} = (substr($CFG->{$path}, -1) != DIRECTORY_SEPARATOR) ? $CFG->{$path} . DIRECTORY_SEPARATOR : $CFG->{$path};
$CFG->{$path} = (substr($CFG->{$path}, -1) != '/') ? $CFG->{$path} . '/' : $CFG->{$path};
}
// xmldb stuff
......
......@@ -1364,7 +1364,7 @@ class PluginImportLeap extends PluginImport {
$this->trace($link);
$pathname = urldecode((string)$link['href']);
$dir = dirname($this->get('filename'));
$pathname = $dir . DIRECTORY_SEPARATOR . $pathname;
$pathname = $dir . '/' . $pathname;
if (!file_exists($pathname)) {
return false;
}
......
......@@ -65,7 +65,7 @@ $CFG = (object)array_merge((array)$cfg, (array)$CFG);
// Fix up paths in $CFG
foreach (array('docroot', 'dataroot') as $path) {
$CFG->{$path} = (substr($CFG->{$path}, -1) != DIRECTORY_SEPARATOR) ? $CFG->{$path} . DIRECTORY_SEPARATOR : $CFG->{$path};
$CFG->{$path} = (substr($CFG->{$path}, -1) != '/') ? $CFG->{$path} . '/' : $CFG->{$path};
}
// xmldb stuff
......
......@@ -720,7 +720,7 @@ function rmdirr($dirname)
}
// Recurse
rmdirr($dirname . DIRECTORY_SEPARATOR . $entry);
rmdirr($dirname . '/' . $entry);
}
// Clean up
......
......@@ -15,8 +15,8 @@ function dirsize($path)
$size = 0;
// Trailing slash
if (substr($path, -1, 1) !== DIRECTORY_SEPARATOR) {
$path .= DIRECTORY_SEPARATOR;
if (substr($path, -1, 1) !== '/') {
$path .= '/';
}
// Sanity check
......@@ -43,7 +43,7 @@ function dirsize($path)
// Get list of directories or filesizes
$path = $queue[$i] . $entry;
if (is_dir($path)) {
$path .= DIRECTORY_SEPARATOR;
$path .= '/';
$subdirs[] = $path;
} elseif (is_file($path)) {
$size += filesize($path);
......
......@@ -726,7 +726,7 @@ class Theme {
private function _get_path($filename, $all, $plugindirectory, $returnprefix) {
$list = array();
$plugindirectory = ($plugindirectory && substr($plugindirectory, -1) != DIRECTORY_SEPARATOR) ? $plugindirectory . DIRECTORY_SEPARATOR : $plugindirectory;
$plugindirectory = ($plugindirectory && substr($plugindirectory, -1) != '/') ? $plugindirectory . '/' : $plugindirectory;
foreach ($this->inheritance as $themedir) {
if (is_readable(get_config('docroot') . $plugindirectory . 'theme/' . $themedir . '/static/' . $filename)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment