Skip to content

Commit

Permalink
Fix windows problem
Browse files Browse the repository at this point in the history
  • Loading branch information
florisbosch committed Dec 19, 2022
1 parent ebbfd0e commit 642603a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/LogFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public function logs(): LogReader

public function size(): int
{
return LogViewer::getFilesystem()->size($this->path);
return LogViewer::getFilesystem()->exists()
? LogViewer::getFilesystem()->size($this->path)
: 0;
}

public function sizeInMB(): float
Expand Down Expand Up @@ -104,13 +106,13 @@ public function getLastScannedFilePositionForQuery(?string $query = ''): ?int
public function earliestTimestamp(): int
{
return $this->getMetadata('earliest_timestamp')
?? LogViewer::getFilesystem()->lastModified($this->path);
?? LogViewer::getFilesystem()->exists($this->path) ? LogViewer::getFilesystem()->lastModified($this->path) : 0;
}

public function latestTimestamp(): int
{
return $this->getMetadata('latest_timestamp')
?? LogViewer::getFilesystem()->lastModified($this->path);
?? LogViewer::getFilesystem()->exists($this->path) ? LogViewer::getFilesystem()->lastModified($this->path) : 0;
}

public function scan(int $maxBytesToScan = null, bool $force = false): void
Expand Down
2 changes: 1 addition & 1 deletion src/LogViewerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function getFilePathsMatchingPattern($pattern)
public function basePathForLogs(): string
{
$rootFolder = Str::of(config('log-viewer.filesystem.root'));
return empty($rootFolder)
return ($rootFolder != "")
? $rootFolder->finish('/')
: $rootFolder;
}
Expand Down

0 comments on commit 642603a

Please sign in to comment.