Skip to content

Commit

Permalink
Use DIRECTORRY_SEPERATOR to support Windows (#38)
Browse files Browse the repository at this point in the history
* Use DIRECTORY_SEPARATOR instead of /
  • Loading branch information
stefanzweifel authored Oct 27, 2023
1 parent 4a4954e commit 997f15f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Databases/MySql.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class MySql extends DbImporter

public function getImportCommand(string $dumpFile, string $connection): string
{
$temporaryDirectoryPath = config('backup.backup.temporary_directory') ?? storage_path('app/backup-temp');
$temporaryDirectoryPath = config('backup.backup.temporary_directory') ?? storage_path('app'.DIRECTORY_SEPARATOR.'backup-temp');

$this->temporaryDirectory = (new TemporaryDirectory($temporaryDirectoryPath))
->name('temp')
Expand Down
10 changes: 5 additions & 5 deletions src/PendingRestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,33 @@ public function getPathToLocalCompressedBackup(): string
{
$filename = "$this->restoreId.{$this->getFileExtensionOfRemoteBackup()}";

return "backup-restore-temp/$filename";
return 'backup-restore-temp'.DIRECTORY_SEPARATOR.$filename;
}

public function getPathToLocalDecompressedBackup(): string
{
$filename = $this->restoreId;

return "backup-restore-temp/$filename";
return 'backup-restore-temp'.DIRECTORY_SEPARATOR.$filename;
}

public function getAbsolutePathToLocalDecompressedBackup(): string
{
$filename = $this->restoreId;

return storage_path("app/backup-restore-temp/$filename");
return storage_path('app'.DIRECTORY_SEPARATOR.'backup-restore-temp'.DIRECTORY_SEPARATOR.$filename);
}

public function hasNoDbDumpsDirectory(): bool
{
return ! Storage::disk($this->restoreDisk)
->has("{$this->getPathToLocalDecompressedBackup()}/db-dumps");
->has($this->getPathToLocalDecompressedBackup().DIRECTORY_SEPARATOR.'db-dumps');
}

public function getAvailableDbDumps(): Collection
{
$files = Storage::disk($this->restoreDisk)
->files("{$this->getPathToLocalDecompressedBackup()}/db-dumps");
->files($this->getPathToLocalDecompressedBackup().DIRECTORY_SEPARATOR.'db-dumps');

return collect($files)
->filter(fn ($file) => Str::endsWith($file, ['.sql', '.sql.gz']));
Expand Down

0 comments on commit 997f15f

Please sign in to comment.