Allow to use relative path at PLUGINS_DIR

This commit is contained in:
Pig Fang 2019-07-01 21:25:25 +08:00
parent e811d1afc3
commit 00d7d5481e
3 changed files with 8 additions and 1 deletions

View File

@ -68,6 +68,9 @@ class PluginManager
$installed = [];
$cwd = getcwd();
chdir(base_path());
try {
$resource = opendir($this->getPluginsDir());
} catch (\Exception $e) {
@ -125,6 +128,8 @@ class PluginManager
$this->plugins = $plugins->sortBy(function ($plugin, $name) {
return $plugin->name;
});
chdir($cwd);
}
return $this->plugins;
@ -400,7 +405,7 @@ class PluginManager
*/
public function getPluginsDir()
{
return config('plugins.directory') ?: base_path('plugins');
return config('plugins.directory') ? realpath(config('plugins.directory')) : base_path('plugins');
}
/**

View File

@ -3,6 +3,7 @@
- Supported Chrome's `theme-color`.
- Allowed to customize HTTP status code for rejecting accessing private texture.
- Added configurable "Explore" menu.
- Custom `PLUGINS_DIR` with relative path is allowed.
## Tweaked

View File

@ -3,6 +3,7 @@
- 支持 Chrome 的 `theme-color` 属性
- 允许自定义拒绝访问私有材质时返回的 HTTP 状态码
- 添加可自定义的「浏览」菜单
- 允许在 `PLUGINS_DIR` 配置项中使用相对路径
## 调整