Skip to content

Commit 0e29f17

Browse files
committed
Use locator to find routerCacheFile
1 parent 1d2d5d1 commit 0e29f17

4 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Changed
1515
- Sprinkle list in the bakery `debug` command to uses the new `sprinkle:list` table
16+
- `routerCacheFile` config now only contains filename. Locator is used to find the full path
1617

1718
### Fix
1819
- Fix for `Test` Bakery command

app/sprinkles/core/config/production.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Use router cache, disable full error details
3636
*/
3737
'settings' => [
38-
'routerCacheFile' => \UserFrosting\ROOT_DIR . '/' . \UserFrosting\APP_DIR_NAME . '/' . \UserFrosting\CACHE_DIR_NAME . '/' . 'routes.cache',
38+
'routerCacheFile' => 'routes.cache',
3939
'displayErrorDetails' => false
4040
],
4141
/*

app/sprinkles/core/src/Bakery/ClearCacheCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
5151
// Clear router cache
5252
$this->io->writeln('<info> > Clearing Router cache file</info>', OutputInterface::VERBOSITY_VERBOSE);
5353
if (!$this->clearRouterCache()) {
54-
$file = $this->ci->config['settings.routerCacheFile'];
54+
$filename = $this->ci->config['settings.routerCacheFile'];
55+
$file = $this->ci->locator->findResource("cache://$filename", true, true);
5556
$this->io->error("Failed to delete Router cache file. Make sure you have write access to the `$file` file.");
5657
exit(1);
5758
}

app/sprinkles/core/src/ServicesProvider/ServicesProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ public function register(ContainerInterface $container)
593593
$container['router'] = function ($c) {
594594
$routerCacheFile = false;
595595
if (isset($c->config['settings.routerCacheFile'])) {
596-
$routerCacheFile = $c->config['settings.routerCacheFile'];
596+
$filename = $c->config['settings.routerCacheFile'];
597+
$routerCacheFile = $c->locator->findResource("cache://$filename", true, true);
597598
}
598599

599600
return (new Router())->setCacheFile($routerCacheFile);

0 commit comments

Comments
 (0)