From c33be8d9d78ea9422c40c4bd9ed83fb6ba59479e Mon Sep 17 00:00:00 2001
From: Bart Jaskulski <bjaskulski@protonmail.com>
Date: Fri, 17 Nov 2023 09:44:41 +0100
Subject: [PATCH] fix: use absolute cache path

Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com>
---
 src/PluginInit.php | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PluginInit.php b/src/PluginInit.php
index a94e909..3194294 100644
--- a/src/PluginInit.php
+++ b/src/PluginInit.php
@@ -75,7 +75,7 @@ final class PluginInit {
 			$this->filename = $backtrace[0]['file'];
 		}
 
-		$cache_path = $this->config->get( 'cache_path', 'generated' ) . '/plugin.php';
+		$cache_path = $this->get_cache_dir() . '/plugin.php';
 		try {
 			$plugin_data = $this->loader->load( $cache_path );
 		} catch ( \Exception $e ) {
@@ -95,6 +95,10 @@ final class PluginInit {
 		return $plugin;
 	}
 
+	private function get_cache_dir(): string {
+		return $this->filename . '/' . $this->config->get( 'cache_path', 'generated' );
+	}
+
 	private function initialize_container( Plugin $plugin ): Container {
 		$original_builder = new DiBuilder();
 		$builder = new ContainerBuilder( $original_builder );
-- 
GitLab