File tree Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Expand file tree Collapse file tree 2 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 22
33namespace Native \Desktop \Builder \Concerns ;
44
5- use Composer \InstalledVersions ;
6- use Symfony \Component \Filesystem \Path ;
5+ use Native \Desktop \Support \Composer ;
76
87use function Laravel \Prompts \error ;
98use function Laravel \Prompts \warning ;
@@ -15,11 +14,7 @@ abstract public function buildPath(string $path = ''): string;
1514 public function copyCertificateAuthority (string $ path ): void
1615 {
1716 try {
18- $ vendorDirectory = realpath (InstalledVersions::getRootPackage ()['install_path ' ].'/vendor ' );
19- $ phpBinaryDirectory = $ vendorDirectory .'/nativephp/php-bin/ ' ;
20-
21- $ certificateFileName = 'cacert.pem ' ;
22- $ certFilePath = Path::join ($ phpBinaryDirectory , $ certificateFileName );
17+ $ certFilePath = Composer::phpPackagePath ('cacert.pem ' );
2318
2419 if (! file_exists ($ certFilePath )) {
2520 warning ('CA Certificate not found at ' .$ certFilePath .'. Skipping copy. ' );
@@ -29,7 +24,7 @@ public function copyCertificateAuthority(string $path): void
2924
3025 $ copied = copy (
3126 $ certFilePath ,
32- "{$ path }/ { $ certificateFileName } "
27+ "{$ path }/cacert.pem "
3328 );
3429
3530 if (! $ copied ) {
Original file line number Diff line number Diff line change 22
33namespace Native \Desktop \Support ;
44
5+ use Composer \InstalledVersions ;
56use RuntimeException ;
7+ use Symfony \Component \Filesystem \Path ;
68
79use function Laravel \Prompts \note ;
810
911class Composer
1012{
13+ public static function desktopPackagePath (string $ path = '' )
14+ {
15+ return self ::vendorPath ("nativephp/desktop/ {$ path }" );
16+ }
17+
18+ public static function phpPackagePath (string $ path = '' )
19+ {
20+ return self ::vendorPath ("nativephp/php-bin/ {$ path }" );
21+ }
22+
23+ public static function vendorPath (string $ path = '' )
24+ {
25+ $ vendorPath = realpath (InstalledVersions::getRootPackage ()['install_path ' ].'/vendor ' );
26+
27+ return Path::join ($ vendorPath , $ path );
28+ }
29+
1130 public static function installScripts ()
1231 {
1332 $ composer = json_decode (file_get_contents (base_path ('composer.json ' )));
You can’t perform that action at this time.
0 commit comments