24
24
import com .intellij .openapi .vfs .LocalFileSystem ;
25
25
import com .intellij .openapi .vfs .VfsUtil ;
26
26
import io .flutter .FlutterBundle ;
27
+ import io .flutter .logging .PluginLogger ;
27
28
import io .flutter .run .test .TestConfig ;
29
+ import io .flutter .settings .FlutterSettings ;
28
30
import io .flutter .utils .OpenApiUtils ;
29
31
import org .jetbrains .annotations .NonNls ;
30
32
import org .jetbrains .annotations .NotNull ;
33
35
import java .nio .file .Files ;
34
36
import java .nio .file .Path ;
35
37
import java .nio .file .Paths ;
38
+ import java .util .Objects ;
36
39
37
40
public class FlutterCoverageProgramRunner extends GenericProgramRunner <RunnerSettings > {
38
- private static final @ NotNull Logger LOG = Logger . getInstance (FlutterCoverageProgramRunner .class . getName () );
41
+ private static final @ NotNull Logger LOG = PluginLogger . createLogger (FlutterCoverageProgramRunner .class );
39
42
40
43
private static final String ID = "FlutterCoverageProgramRunner" ;
41
44
private ProcessHandler handler ;
@@ -98,7 +101,17 @@ private void processCoverage(ExecutionEnvironment env) {
98
101
}
99
102
}
100
103
else {
101
- LOG .error (FlutterBundle .message ("coverage.path.not.found" , path ));
104
+ LOG .error (FlutterBundle .message ("coverage.path.not.found" , getSafePath ( path ) ));
102
105
}
103
106
}
107
+
108
+ private @ NotNull String getSafePath (@ NotNull Path path ) {
109
+ if (FlutterSettings .getInstance ().isFilePathLoggingEnabled ()) {
110
+ return path .toString ();
111
+ }
112
+
113
+ if (path .getNameCount () == 0 ) return "" ;
114
+
115
+ return Objects .requireNonNull (path .getFileName ()).toString ();
116
+ }
104
117
}
0 commit comments