From 642603a164d554e95e44b20fa00aa41f7c9963b4 Mon Sep 17 00:00:00 2001 From: Florisbosch Date: Mon, 19 Dec 2022 22:03:51 +0100 Subject: [PATCH] Fix windows problem --- src/LogFile.php | 8 +++++--- src/LogViewerService.php | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/LogFile.php b/src/LogFile.php index 23087da7..74c1d856 100644 --- a/src/LogFile.php +++ b/src/LogFile.php @@ -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 @@ -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 diff --git a/src/LogViewerService.php b/src/LogViewerService.php index 28f6a503..7f1c6ed8 100755 --- a/src/LogViewerService.php +++ b/src/LogViewerService.php @@ -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; }