Improve windows support, fixes #264, #298 and #307

This commit is contained in:
Stéphane Goetz 2015-08-15 16:31:36 +02:00
parent edb670ba3e
commit dc1965a2e7
4 changed files with 17 additions and 5 deletions

View File

@ -490,6 +490,11 @@ The `web.config` needs an entry for `<rewrite>` under `<system.webServer>`:
To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/). To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, such as [URL Rewriter](http://urlrewriter.net/).
## Known Issues
- __Windows UTF-8 files support__ Files with UTF-8 characters cannot be handled on windows, this issue has no known fix yet.
## Support ## Support
If you need help using Daux.io, or have found a bug, please create an issue on the <a href="https://github.com/justinwalsh/daux.io/issues" target="_blank">GitHub repo</a>. If you need help using Daux.io, or have found a bug, please create an issue on the <a href="https://github.com/justinwalsh/daux.io/issues" target="_blank">GitHub repo</a>.

View File

@ -59,10 +59,13 @@ class GeneratorHelper
$dir = opendir($source); $dir = opendir($source);
while (false !== ($file = readdir($dir))) { while (false !== ($file = readdir($dir))) {
if ($file != '.' && $file != '..') { if ($file != '.' && $file != '..') {
if (is_dir($source . '/' . $file)) { if (is_dir($source . DIRECTORY_SEPARATOR . $file)) {
static::copyRecursive($source . '/' . $file, $destination . '/' . $file); static::copyRecursive(
$source . DIRECTORY_SEPARATOR . $file,
$destination . DIRECTORY_SEPARATOR . $file
);
} else { } else {
copy($source . '/' . $file, $destination . '/' . $file); copy($source . DIRECTORY_SEPARATOR . $file, $destination . DIRECTORY_SEPARATOR . $file);
} }
} }
} }

View File

@ -71,7 +71,11 @@ class Server
$this->daux = $daux; $this->daux = $daux;
$this->host = $_SERVER['HTTP_HOST']; $this->host = $_SERVER['HTTP_HOST'];
$this->base_url = $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// The path has a special treatment on windows, revert the slashes
$dir = dirname($_SERVER['PHP_SELF']);
$this->base_url = $_SERVER['HTTP_HOST'] . (DIRECTORY_SEPARATOR == "\\"? str_replace($dir,"\\","/") : $dir);
$t = strrpos($this->base_url, '/index.php'); $t = strrpos($this->base_url, '/index.php');
if ($t != false) { if ($t != false) {
$this->base_url = substr($this->base_url, 0, $t); $this->base_url = substr($this->base_url, 0, $t);

View File

@ -98,7 +98,7 @@ class Builder
*/ */
protected static function getFilename($file) protected static function getFilename($file)
{ {
$parts = explode('/', $file); $parts = explode(DIRECTORY_SEPARATOR, $file);
return end($parts); return end($parts);
} }