Skip to content

Commit 26051aa

Browse files
committed
Remove /path/to/tmp/compile/dir and /path/to/cores from compiler output.
1 parent 087b254 commit 26051aa

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,9 @@ private function doCompile($compiler_config, &$files, $dir, $CC, $CFLAGS, $CPP,
648648
$output = str_replace("$dir/", "", $output); // XXX
649649
$output = $this->postproc->ansi_to_html(implode("\n", $output));
650650

651+
$output = $this->pathRemover ($output, $compiler_config);
652+
$avr_output = $this->pathRemover ($avr_output, $compiler_config);
653+
651654
$resp = array(
652655
"success" => false,
653656
"step" => 4,
@@ -1196,4 +1199,26 @@ private function cleanUpClangOutput ($clang_output, $compiler_config) {
11961199
return $final;
11971200
}
11981201

1202+
private function pathRemover ($output, $compiler_config) {
1203+
1204+
$core_pattern = "/" . str_replace("/", "\\/", $compiler_config["arduino_cores_dir"]) . "([.*\\S]*\\/)" . "/";
1205+
$external_core_pattern = "//";
1206+
if (isset($compiler_config["external_core_files"]) && $compiler_config["external_core_files"] != "")
1207+
$external_core_pattern = "/" . str_replace("/", "\\/", $compiler_config["external_core_files"]) . "([.*\\S]*\\/)" . "/";
1208+
1209+
// Remove any instance of "compiler.RANDOM/files/" folder name from the text
1210+
$modified = str_replace($compiler_config["compiler_dir"] . "/files/", '', $output);
1211+
1212+
// Remove any remaining instance of "compiler.RANDOM/" folder name from the text.
1213+
$modified = str_replace($compiler_config["compiler_dir"] . "/", '', $modified);
1214+
1215+
// Remove any instance of codebender arduino core files folder name from the text
1216+
$modified = preg_replace($core_pattern, '', $modified);
1217+
1218+
// Remove any instance of codebender external core file folder name from the text
1219+
$modified = preg_replace($external_core_pattern, '', $modified);
1220+
1221+
return $modified;
1222+
}
1223+
11991224
}

0 commit comments

Comments
 (0)