Skip to content

Commit 8603eb9

Browse files
Fixed paths
1 parent 7b344ff commit 8603eb9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/Processors/Migrate.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ protected function getNewFiles(): array
6767
{
6868
$completed = $this->repository->getCompleted()->pluck('action')->toArray();
6969

70-
return $this->getFiles(fn (string $file) => ! Str::of($file)->replace('\\', '/')->contains($completed), $this->options->path);
70+
return $this->getFiles(
71+
filter : fn (string $file) => ! Str::of($file)->replace('\\', '/')->contains($completed),
72+
path : $this->options->path,
73+
fullpath: true
74+
);
7175
}
7276

7377
protected function getBatch(): int

src/Processors/Processor.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
use DragonCode\LaravelActions\Repositories\ActionRepository;
1313
use DragonCode\LaravelActions\Services\Migrator;
1414
use DragonCode\LaravelActions\Values\Options;
15+
use DragonCode\Support\Facades\Helpers\Arr;
1516
use DragonCode\Support\Facades\Helpers\Str;
1617
use DragonCode\Support\Filesystem\File;
18+
use DragonCode\Support\Helpers\Ables\Arrayable;
1719
use Illuminate\Console\OutputStyle;
1820
use Illuminate\Contracts\Events\Dispatcher;
1921
use Symfony\Component\Console\Input\InputInterface;
@@ -41,11 +43,17 @@ public function __construct(
4143
$this->migrator->setConnection($this->options->connection)->setOutput($this->output);
4244
}
4345

44-
protected function getFiles(?Closure $filter = null, ?string $path = null, bool $realpath = false): array
46+
protected function getFiles(?Closure $filter = null, ?string $path = null, bool $realpath = false, bool $fullpath = false): array
4547
{
4648
$path = $this->getActionsPath($path, $realpath);
4749

48-
return $this->file->exists($path) ? [$path] : $this->file->names($path, $filter, true);
50+
$names = $this->file->exists($path) ? [$path] : $this->file->allPaths($path, $filter, true);
51+
52+
return Arr::of($names)
53+
->when(! $fullpath, fn (Arrayable $array) => $array
54+
->map(fn (string $value) => Str::of(realpath($value))->after(realpath($path))->ltrim('\\/')->toString())
55+
)
56+
->toArray();
4957
}
5058

5159
protected function getActionsPath(?string $path = null, bool $realpath = false): string

0 commit comments

Comments
 (0)