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 2
2
3
3
namespace Native \Desktop \Builder \Concerns ;
4
4
5
- use Composer \InstalledVersions ;
6
- use Symfony \Component \Filesystem \Path ;
5
+ use Native \Desktop \Support \Composer ;
7
6
8
7
use function Laravel \Prompts \error ;
9
8
use function Laravel \Prompts \warning ;
@@ -15,11 +14,7 @@ abstract public function buildPath(string $path = ''): string;
15
14
public function copyCertificateAuthority (string $ path ): void
16
15
{
17
16
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 ' );
23
18
24
19
if (! file_exists ($ certFilePath )) {
25
20
warning ('CA Certificate not found at ' .$ certFilePath .'. Skipping copy. ' );
@@ -29,7 +24,7 @@ public function copyCertificateAuthority(string $path): void
29
24
30
25
$ copied = copy (
31
26
$ certFilePath ,
32
- "{$ path }/ { $ certificateFileName } "
27
+ "{$ path }/cacert.pem "
33
28
);
34
29
35
30
if (! $ copied ) {
Original file line number Diff line number Diff line change 2
2
3
3
namespace Native \Desktop \Support ;
4
4
5
+ use Composer \InstalledVersions ;
5
6
use RuntimeException ;
7
+ use Symfony \Component \Filesystem \Path ;
6
8
7
9
use function Laravel \Prompts \note ;
8
10
9
11
class Composer
10
12
{
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
+
11
30
public static function installScripts ()
12
31
{
13
32
$ composer = json_decode (file_get_contents (base_path ('composer.json ' )));
You can’t perform that action at this time.
0 commit comments