Skip to content

Commit 642603a

Browse files
committed
Fix windows problem
1 parent ebbfd0e commit 642603a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/LogFile.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ public function logs(): LogReader
5151

5252
public function size(): int
5353
{
54-
return LogViewer::getFilesystem()->size($this->path);
54+
return LogViewer::getFilesystem()->exists()
55+
? LogViewer::getFilesystem()->size($this->path)
56+
: 0;
5557
}
5658

5759
public function sizeInMB(): float
@@ -104,13 +106,13 @@ public function getLastScannedFilePositionForQuery(?string $query = ''): ?int
104106
public function earliestTimestamp(): int
105107
{
106108
return $this->getMetadata('earliest_timestamp')
107-
?? LogViewer::getFilesystem()->lastModified($this->path);
109+
?? LogViewer::getFilesystem()->exists($this->path) ? LogViewer::getFilesystem()->lastModified($this->path) : 0;
108110
}
109111

110112
public function latestTimestamp(): int
111113
{
112114
return $this->getMetadata('latest_timestamp')
113-
?? LogViewer::getFilesystem()->lastModified($this->path);
115+
?? LogViewer::getFilesystem()->exists($this->path) ? LogViewer::getFilesystem()->lastModified($this->path) : 0;
114116
}
115117

116118
public function scan(int $maxBytesToScan = null, bool $force = false): void

src/LogViewerService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ protected function getFilePathsMatchingPattern($pattern)
7373
public function basePathForLogs(): string
7474
{
7575
$rootFolder = Str::of(config('log-viewer.filesystem.root'));
76-
return empty($rootFolder)
76+
return ($rootFolder != "")
7777
? $rootFolder->finish('/')
7878
: $rootFolder;
7979
}

0 commit comments

Comments
 (0)