Skip to content

Commit e1a1856

Browse files
authored
Fix Windows path resolution (#122)
1 parent 78734a8 commit e1a1856

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/Commands/MakeComponent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Str;
88
use Statamic\Console\RunsInPlease;
99
use Statamic\Facades\Form;
10+
use Statamic\Facades\Path;
1011

1112
use function Laravel\Prompts\confirm;
1213
use function Laravel\Prompts\error;
@@ -57,6 +58,6 @@ public function handle(): void
5758

5859
protected function getRelativePath($path): string
5960
{
60-
return str_replace(base_path().'/', '', $path);
61+
return Path::makeRelative($path);
6162
}
6263
}

src/Commands/MakeTheme.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\File;
88
use Illuminate\Support\Str;
99
use Statamic\Console\RunsInPlease;
10+
use Statamic\Facades\Path;
1011

1112
use function Laravel\Prompts\confirm;
1213
use function Laravel\Prompts\info;
@@ -33,6 +34,6 @@ public function handle(): void
3334

3435
protected function getRelativePath($path): string
3536
{
36-
return str_replace(base_path().'/', '', $path);
37+
return Path::makeRelative($path);
3738
}
3839
}

src/Commands/MakeView.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\Facades\File;
88
use Illuminate\Support\Str;
99
use Statamic\Console\RunsInPlease;
10+
use Statamic\Facades\Path;
1011

1112
use function Laravel\Prompts\confirm;
1213
use function Laravel\Prompts\info;
@@ -36,6 +37,6 @@ public function handle(): void
3637

3738
protected function getRelativePath($path): string
3839
{
39-
return str_replace(base_path().'/', '', $path);
40+
return Path::makeRelative($path);
4041
}
4142
}

src/ViewManager.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ public function absoluteViewPath(string $path = ''): string
1919

2020
public function viewPath(string $view = ''): string
2121
{
22-
return Str::after($this->absoluteViewPath($view), resource_path('views/'));
22+
return Str::after(
23+
$this->absoluteViewPath($view),
24+
Path::tidy(resource_path('views/'))
25+
);
2326
}
2427

2528
public function themeViewPath(string $theme, string $view): string

0 commit comments

Comments
 (0)