Skip to content

Commit ae1e412

Browse files
committed
determine electron path
1 parent 0653ab5 commit ae1e412

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/Drivers/Electron/ElectronServiceProvider.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@
1111
use Native\Desktop\Drivers\Electron\Commands\PublishCommand;
1212
use Native\Desktop\Drivers\Electron\Commands\ResetCommand;
1313
use Native\Desktop\Drivers\Electron\Updater\UpdaterManager;
14+
use Native\Desktop\Support\Composer;
1415
use Spatie\LaravelPackageTools\Package;
1516
use Spatie\LaravelPackageTools\PackageServiceProvider;
1617

1718
class ElectronServiceProvider extends PackageServiceProvider
1819
{
19-
const ELECTRON_PATH = __DIR__.'/../../../resources/electron';
20+
public static function electronPath(string $path = '')
21+
{
22+
// Will use the published electron project, or fallback to the vendor default
23+
$publishedProjectPath = base_path("nativephp/electron/{$path}");
24+
25+
return is_dir($publishedProjectPath)
26+
? $publishedProjectPath
27+
: Composer::desktopPackagePath("resources/electron/{$path}");
28+
}
29+
30+
public static function buildPath(string $path = '')
31+
{
32+
return Composer::desktopPackagePath("resources/build/{$path}");
33+
}
2034

2135
public function configurePackage(Package $package): void
2236
{
@@ -40,7 +54,7 @@ public function packageRegistered(): void
4054

4155
$this->app->bind(Builder::class, function () {
4256
return Builder::make(
43-
buildPath: self::ELECTRON_PATH.'/resources/app'
57+
buildPath: self::buildPath('app')
4458
);
4559
});
4660
}

0 commit comments

Comments
 (0)