[VD:LocalFileSystem] fix #1127 autodetection of systemRoot

Volume driver option `path` supported Windows absolute path.
This commit is contained in:
nao-pon
2015-11-13 22:18:26 +09:00
parent 3c5f02d2b6
commit efccca9754
+14 -1
View File
@@ -59,7 +59,20 @@ class elFinderVolumeLocalFileSystem extends elFinderVolumeDriver {
}
}
}
$this->root = $this->getFullPath($this->root, getcwd());
if (!$cwd = getcwd()) {
return $this->setError('elFinder LocalVolumeDriver requires a result of getcwd().');
}
// detect systemRoot
if (!isset($this->options['systemRoot'])) {
if ($cwd[0] === $this->separator || $this->root[0] === $this->separator) {
$this->systemRoot = $this->separator;
} else if (preg_match('/^([a-zA-Z]:'.preg_quote($this->separator, '/').')/', $this->root, $m)) {
$this->systemRoot = $m[1];
} else if (preg_match('/^([a-zA-Z]:'.preg_quote($this->separator, '/').')/', $cwd, $m)) {
$this->systemRoot = $m[1];
}
}
$this->root = $this->getFullPath($this->root, $cwd);
return true;
}