Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 13 additions & 24 deletions bin/apphost
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
<?php

use DevNet\System\Runtime\Launcher;

$root = dirname(__FILE__, 2);

// Loads local devnet host if exist
// Load the devnet host, the local one or the global one
if (is_file($root . '/vendor/devnet/system/host.php')) {
require $root . '/vendor/devnet/system/host.php';
}

// Gets the path environment variable
if (PHP_OS_FAMILY == 'Windows') {
$paths = explode(';', getenv('path'));
} else {
$paths = explode(':', getenv('PATH'));
}
// Get the path environment variable
if (PHP_OS_FAMILY == 'Windows') {
$paths = explode(';', getenv('path'));
} else {
$paths = explode(':', getenv('PATH'));
}

// Search for the global devnet host
foreach ($paths as $path) {
if (is_file($path . '/../devnet/system/host.php')) {
require $path . '/../devnet/system/host.php';
break;
// Search for the global devnet host
foreach ($paths as $path) {
if (is_file($path . '/../devnet/system/host.php')) {
require $path . '/../devnet/system/host.php';
break;
}
}
}


// Gets the console arguments without command name
$args = $GLOBALS['argv'] ?? [];
array_shift($args);

// Initialize and launch the application
$launcher = Launcher::initialize($root . '/devnet.proj');
$launcher->launch($args);