Skip to content
Snippets Groups Projects
Commit e6a06029 authored by jurgenhaas's avatar jurgenhaas
Browse files

Properly determine host's source directory in local dev mode

parent 752c5ec5
No related branches found
Tags v1.9.3
No related merge requests found
......@@ -341,6 +341,7 @@ class Handler extends BaseHandler {
*/
private function getDockerMountSource($projectRoot): string {
try {
$currentDir = getcwd();
$output = [];
exec('basename "$(cat /proc/1/cpuset)"', $output);
$id = reset($output);
......@@ -348,8 +349,15 @@ class Handler extends BaseHandler {
exec('docker container inspect ' . $id, $output);
$container = json_decode(implode('', $output), TRUE)[0];
foreach ($container['Mounts'] as $mount) {
if (strpos($projectRoot, $mount['Destination']) === 0) {
return $mount['Source'] . substr($projectRoot, strlen($mount['Destination']));
if (empty($projectRoot)) {
if ($currentDir === $mount['Destination']) {
return $mount['Source'];
}
}
else {
if (strpos($projectRoot, $mount['Destination']) === 0) {
return $mount['Source'] . substr($projectRoot, strlen($mount['Destination']));
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment