Skip to content

Commit

Permalink
Added DIRECTORY_SEPARATOR to be compatible with Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Kündig committed Mar 30, 2016
1 parent 803694a commit 0c8fbea
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions october
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
define('DS', DIRECTORY_SEPARATOR);

if (file_exists(__DIR__.'/../../autoload.php')) {
require __DIR__.'/../../autoload.php';
Expand Down
6 changes: 3 additions & 3 deletions src/Console/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('<info>Creating project directory...</info>');

$dir = getcwd() . '/' . $input->getArgument('directory');
$dir = getcwd() . DS . $input->getArgument('directory');

$this->createWorkingDirectory($dir);

$template = __DIR__ . '/../../october.yaml';
$target = $dir . '/october.yaml';
$template = __DIR__ . DS . implode(DS, ['..', '..', 'october.yaml']);
$target = $dir . DS . 'october.yaml';

$output->writeln('<info>Creating default october.yaml...</info>');

Expand Down
4 changes: 2 additions & 2 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
}

$configFile = getcwd() . '/october.yaml';
$configFile = getcwd() . DS . 'october.yaml';
if ( ! file_exists($configFile)) {
return $output->writeln('<comment>october.yaml not found. Run october init first.</comment>');
}
Expand Down Expand Up @@ -121,7 +121,7 @@ protected function writeConfig()
*/
protected function gitignore()
{
file_put_contents(getcwd() . '/.gitignore', implode("\n", [
file_put_contents(getcwd() . DS . '.gitignore', implode("\n", [
'.DS_Store',
'*.log',
'*node_modules*',
Expand Down
4 changes: 2 additions & 2 deletions src/Downloader/OctoberCms.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function cleanUp()
@unlink($this->zipFile);

$directory = getcwd();
$source = $directory . '/october-master';
$source = $directory . DS . 'october-master';

(new Process(sprintf('mv %s %s', $source . '/*', $directory)))->run();
(new Process(sprintf('rm -rf %s', $source)))->run();
Expand All @@ -102,7 +102,7 @@ protected function cleanUp()
*/
protected function makeFilename()
{
return getcwd() . '/october_' . md5(time() . uniqid()) . '.zip';
return getcwd() . DS . 'october_' . md5(time() . uniqid()) . '.zip';
}

}
4 changes: 2 additions & 2 deletions src/Installer/PluginInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function install()
}

$vendorDir = $this->createVendorDir($vendor);
$pluginDir = $vendorDir . '/' . $plugin;
$pluginDir = $vendorDir . DS . $plugin;

$this->mkdir($pluginDir);

Expand Down Expand Up @@ -88,7 +88,7 @@ protected function parse($plugin)
*/
protected function createVendorDir($vendor)
{
$pluginDir = getcwd() . '/plugins/' . $vendor;
$pluginDir = getcwd() . DS . implode(DS, ['plugins', $vendor]);

return $this->mkdir($pluginDir);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Installer/ThemeInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function install()
return;
}

$themeDir = getcwd() . '/themes/' . $theme;
$themeDir = getcwd() . DS . implode(DS, ['themes', $theme]);
if ( ! is_dir($themeDir)) {
mkdir($themeDir);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Util/ConfigWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(Rewrite $writer = null)
$writer = new Rewrite();
}
$this->writer = $writer;
$this->dir = getcwd() . '/config';
$this->dir = getcwd() . DS . 'config';
}

/**
Expand All @@ -44,7 +44,7 @@ public function __construct(Rewrite $writer = null)
*/
public function setAppEnv($appEnv = 'dev')
{
file_put_contents(getcwd() . '/.env', 'APP_ENV=' . $appEnv);
file_put_contents(getcwd() . DS . '.env', 'APP_ENV=' . $appEnv);

return $this;
}
Expand All @@ -63,7 +63,7 @@ public function copyConfigFileToEnv($files)
foreach ($files as $file) {
$target = $this->filePath($file);
if ( ! file_exists($target)) {
copy($this->dir . '/' . $file . '.php', $target);
copy($this->dir . DS . $file . '.php', $target);
}
}

Expand Down Expand Up @@ -119,7 +119,7 @@ private function writeApp(array $values)
*/
public function setAppKey($key)
{
$this->writer->toFile($this->dir . '/app.php', compact('key'), false);
$this->writer->toFile($this->dir . DS . 'app.php', compact('key'), false);
}

/**
Expand All @@ -129,8 +129,8 @@ public function setAppKey($key)
*/
protected function filePath($file)
{
$envPath = $this->env === 'prod' ? '' : $this->env . '/';
$targetDir = $this->dir . '/' . $envPath;
$envPath = $this->env === 'prod' ? '' : $this->env . DS;
$targetDir = $this->dir . DS . $envPath;

if ( ! is_dir($targetDir)) {
mkdir($targetDir);
Expand Down

0 comments on commit 0c8fbea

Please sign in to comment.