File tree 3 files changed +23
-10
lines changed
3 files changed +23
-10
lines changed Original file line number Diff line number Diff line change 13
13
14
14
/*
15
15
|--------------------------------------------------------------------------
16
- | Symbolic path
16
+ | Symbolic link path
17
17
|--------------------------------------------------------------------------
18
18
|
19
19
| you can change the public themes path used for assets.
20
20
|
21
21
*/
22
22
'symlink_path ' => 'themes ' ,
23
23
24
+ /*
25
+ |--------------------------------------------------------------------------
26
+ | Symbolic link relative
27
+ |--------------------------------------------------------------------------
28
+ |
29
+ | Determine if relative symlink should be used instead of absolute one.
30
+ |
31
+ */
32
+ 'symlink_relative ' => false ,
33
+
24
34
/*
25
35
|--------------------------------------------------------------------------
26
36
| Fallback Theme
Original file line number Diff line number Diff line change 2
2
3
3
namespace Hexadog \ThemesManager \Providers ;
4
4
5
- use File ;
6
5
use ReflectionClass ;
7
6
use Illuminate \Support \Str ;
8
7
use Illuminate \Routing \Router ;
9
- use Illuminate \Filesystem \Filesystem ;
10
8
use Illuminate \Contracts \View \Factory ;
11
9
use Illuminate \Foundation \AliasLoader ;
12
10
use Illuminate \Support \ServiceProvider ;
@@ -69,12 +67,6 @@ protected function getNormalizedNamespace($prefix = '')
69
67
*/
70
68
public function boot (Router $ router )
71
69
{
72
- $ publicPath = public_path (config ('themes-manager.symlink_path ' , 'themes ' ));
73
-
74
- if (!File::exists ($ publicPath )) {
75
- app (Filesystem::class)->makeDirectory ($ publicPath , 0755 );
76
- }
77
-
78
70
$ this ->loadViewsFrom ($ this ->getPath ('resources/views ' ), 'themes-manager ' );
79
71
$ this ->loadViewComponentsAs ('theme ' , [
80
72
Image::class,
Original file line number Diff line number Diff line change @@ -361,11 +361,22 @@ protected function cleanPath($path = '')
361
361
*/
362
362
protected function registerViews ()
363
363
{
364
+ // Create target symlink parent directory if required
365
+ $ publicPath = public_path (Config::get ('themes-manager.symlink_path ' , 'themes ' ));
366
+ if (!File::exists ($ publicPath )) {
367
+ app (Filesystem::class)->makeDirectory ($ publicPath , 0755 );
368
+ }
369
+
364
370
// Create symlink for public resources if not existing yet
365
371
$ assetsPath = $ this ->getPath ('public ' );
366
372
$ publicAssetsPath = public_path ($ this ->getAssetsPath ());
373
+
367
374
if (!File::exists ($ publicAssetsPath ) && File::exists ($ assetsPath )) {
368
- app (Filesystem::class)->link ($ assetsPath , rtrim ($ publicAssetsPath , DIRECTORY_SEPARATOR ));
375
+ if (Config::get ('themes-manager.symlink_relative ' , false )) {
376
+ app (Filesystem::class)->relativeLink ($ assetsPath , rtrim ($ publicAssetsPath , DIRECTORY_SEPARATOR ));
377
+ } else {
378
+ app (Filesystem::class)->link ($ assetsPath , rtrim ($ publicAssetsPath , DIRECTORY_SEPARATOR ));
379
+ }
369
380
}
370
381
371
382
// Register theme views path
You can’t perform that action at this time.
0 commit comments