Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 0c8fbea

Browse files
author
Tobias Kündig
committed
Added DIRECTORY_SEPARATOR to be compatible with Windows
1 parent 803694a commit 0c8fbea

7 files changed

Lines changed: 17 additions & 16 deletions

File tree

october

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env php
22
<?php
3+
define('DS', DIRECTORY_SEPARATOR);
34

45
if (file_exists(__DIR__.'/../../autoload.php')) {
56
require __DIR__.'/../../autoload.php';

src/Console/InitCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
4242
{
4343
$output->writeln('<info>Creating project directory...</info>');
4444

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

4747
$this->createWorkingDirectory($dir);
4848

49-
$template = __DIR__ . '/../../october.yaml';
50-
$target = $dir . '/october.yaml';
49+
$template = __DIR__ . DS . implode(DS, ['..', '..', 'october.yaml']);
50+
$target = $dir . DS . 'october.yaml';
5151

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

src/Console/InstallCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
5858
throw new RuntimeException('The Zip PHP extension is not installed. Please install it and try again.');
5959
}
6060

61-
$configFile = getcwd() . '/october.yaml';
61+
$configFile = getcwd() . DS . 'october.yaml';
6262
if ( ! file_exists($configFile)) {
6363
return $output->writeln('<comment>october.yaml not found. Run october init first.</comment>');
6464
}
@@ -121,7 +121,7 @@ protected function writeConfig()
121121
*/
122122
protected function gitignore()
123123
{
124-
file_put_contents(getcwd() . '/.gitignore', implode("\n", [
124+
file_put_contents(getcwd() . DS . '.gitignore', implode("\n", [
125125
'.DS_Store',
126126
'*.log',
127127
'*node_modules*',

src/Downloader/OctoberCms.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function cleanUp()
8383
@unlink($this->zipFile);
8484

8585
$directory = getcwd();
86-
$source = $directory . '/october-master';
86+
$source = $directory . DS . 'october-master';
8787

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

108108
}

src/Installer/PluginInstaller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function install()
4747
}
4848

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

5252
$this->mkdir($pluginDir);
5353

@@ -88,7 +88,7 @@ protected function parse($plugin)
8888
*/
8989
protected function createVendorDir($vendor)
9090
{
91-
$pluginDir = getcwd() . '/plugins/' . $vendor;
91+
$pluginDir = getcwd() . DS . implode(DS, ['plugins', $vendor]);
9292

9393
return $this->mkdir($pluginDir);
9494
}

src/Installer/ThemeInstaller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function install()
4242
return;
4343
}
4444

45-
$themeDir = getcwd() . '/themes/' . $theme;
45+
$themeDir = getcwd() . DS . implode(DS, ['themes', $theme]);
4646
if ( ! is_dir($themeDir)) {
4747
mkdir($themeDir);
4848
}

src/Util/ConfigWriter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function __construct(Rewrite $writer = null)
3434
$writer = new Rewrite();
3535
}
3636
$this->writer = $writer;
37-
$this->dir = getcwd() . '/config';
37+
$this->dir = getcwd() . DS . 'config';
3838
}
3939

4040
/**
@@ -44,7 +44,7 @@ public function __construct(Rewrite $writer = null)
4444
*/
4545
public function setAppEnv($appEnv = 'dev')
4646
{
47-
file_put_contents(getcwd() . '/.env', 'APP_ENV=' . $appEnv);
47+
file_put_contents(getcwd() . DS . '.env', 'APP_ENV=' . $appEnv);
4848

4949
return $this;
5050
}
@@ -63,7 +63,7 @@ public function copyConfigFileToEnv($files)
6363
foreach ($files as $file) {
6464
$target = $this->filePath($file);
6565
if ( ! file_exists($target)) {
66-
copy($this->dir . '/' . $file . '.php', $target);
66+
copy($this->dir . DS . $file . '.php', $target);
6767
}
6868
}
6969

@@ -119,7 +119,7 @@ private function writeApp(array $values)
119119
*/
120120
public function setAppKey($key)
121121
{
122-
$this->writer->toFile($this->dir . '/app.php', compact('key'), false);
122+
$this->writer->toFile($this->dir . DS . 'app.php', compact('key'), false);
123123
}
124124

125125
/**
@@ -129,8 +129,8 @@ public function setAppKey($key)
129129
*/
130130
protected function filePath($file)
131131
{
132-
$envPath = $this->env === 'prod' ? '' : $this->env . '/';
133-
$targetDir = $this->dir . '/' . $envPath;
132+
$envPath = $this->env === 'prod' ? '' : $this->env . DS;
133+
$targetDir = $this->dir . DS . $envPath;
134134

135135
if ( ! is_dir($targetDir)) {
136136
mkdir($targetDir);

0 commit comments

Comments
 (0)