Skip to content

Commit ac58081

Browse files
committed
update apphost & devnet.proj of devnet templates
1 parent 8943840 commit ac58081

File tree

4 files changed

+38
-30
lines changed

4 files changed

+38
-30
lines changed

templates/console/bin/apphost

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22

33
use DevNet\System\Runtime\Launcher;
44

5-
// get the path environment variable
5+
$root = dirname(__FILE__, 2);
6+
7+
// Loads local devnet core host if exist
8+
if (is_file($root . '/vendor/devnet/core/host/corehost.php')) {
9+
require $root . '/vendor/devnet/core/host/corehost.php';
10+
}
11+
12+
// Gets the path environment variable
613
if (PHP_OS_FAMILY == 'Windows') {
714
$paths = explode(';', getenv('path'));
815
} else {
916
$paths = explode(':', getenv('PATH'));
1017
}
1118

12-
// search and load global composer autoload
19+
// Search for the global devnet core host
1320
foreach ($paths as $path) {
14-
if (file_exists($path . '/../autoload.php')) {
15-
require $path . '/../autoload.php';
21+
if (is_file($path . '/../devnet/core/host/corehost.php')) {
22+
require $path . '/../devnet/core/host/corehost.php';
1623
break;
1724
}
1825
}
1926

20-
$root = dirname(__FILE__, 2);
21-
// load local composer autoload
22-
if (file_exists($root . '/vendor/autoload.php')) {
23-
require $root . '/vendor/autoload.php';
24-
}
2527

26-
// get the console arguments without command name
28+
// Gets the console arguments without command name
2729
$args = $GLOBALS['argv'] ?? [];
2830
array_shift($args);
2931

30-
// initialize and launch the application
31-
$launcher = Launcher::initialize($root.'/devnet.proj');
32-
$launcher->launch($args);
32+
// Initialize and launch the application
33+
$launcher = Launcher::initialize($root . '/devnet.proj');
34+
$launcher->launch($args);

templates/console/devnet.proj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<Project>
33
<Properties>
44
<StartupObject>Application\Program</StartupObject>
5-
<RootNamespace>Application</RootNamespace>
65
</Properties>
7-
</Project>
6+
<Items>
7+
<CodeFile include="vendor/autoload.php"/>
8+
</Items>
9+
</Project>

templates/web/bin/apphost

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,33 @@
22

33
use DevNet\System\Runtime\Launcher;
44

5-
// get the path environment variable
5+
$root = dirname(__FILE__, 2);
6+
7+
// Loads local devnet core host if exist
8+
if (is_file($root . '/vendor/devnet/core/host/corehost.php')) {
9+
require $root . '/vendor/devnet/core/host/corehost.php';
10+
}
11+
12+
// Gets the path environment variable
613
if (PHP_OS_FAMILY == 'Windows') {
714
$paths = explode(';', getenv('path'));
815
} else {
916
$paths = explode(':', getenv('PATH'));
1017
}
1118

12-
// search and load global composer autoload
19+
// Search for the global devnet core host
1320
foreach ($paths as $path) {
14-
if (file_exists($path . '/../autoload.php')) {
15-
require $path . '/../autoload.php';
21+
if (is_file($path . '/../devnet/core/host/corehost.php')) {
22+
require $path . '/../devnet/core/host/corehost.php';
1623
break;
1724
}
1825
}
1926

20-
$root = dirname(__FILE__, 2);
21-
// load local composer autoload
22-
if (file_exists($root . '/vendor/autoload.php')) {
23-
require $root . '/vendor/autoload.php';
24-
}
2527

26-
// get the console arguments without command name
28+
// Gets the console arguments without command name
2729
$args = $GLOBALS['argv'] ?? [];
2830
array_shift($args);
2931

30-
// initialize and launch the application
31-
$launcher = Launcher::initialize($root.'/devnet.proj');
32-
$launcher->launch($args);
32+
// Initialize and launch the application
33+
$launcher = Launcher::initialize($root . '/devnet.proj');
34+
$launcher->launch($args);

templates/web/devnet.proj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<Project>
33
<Properties>
44
<StartupObject>Application\Program</StartupObject>
5-
<RootNamespace>Application</RootNamespace>
65
</Properties>
7-
</Project>
6+
<Items>
7+
<CodeFile include="vendor/autoload.php"/>
8+
</Items>
9+
</Project>

0 commit comments

Comments
 (0)