2424import com .intellij .openapi .vfs .LocalFileSystem ;
2525import com .intellij .openapi .vfs .VfsUtil ;
2626import io .flutter .FlutterBundle ;
27+ import io .flutter .logging .PluginLogger ;
2728import io .flutter .run .test .TestConfig ;
29+ import io .flutter .settings .FlutterSettings ;
2830import io .flutter .utils .OpenApiUtils ;
2931import org .jetbrains .annotations .NonNls ;
3032import org .jetbrains .annotations .NotNull ;
3335import java .nio .file .Files ;
3436import java .nio .file .Path ;
3537import java .nio .file .Paths ;
38+ import java .util .Objects ;
3639
3740public 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 );
3942
4043 private static final String ID = "FlutterCoverageProgramRunner" ;
4144 private ProcessHandler handler ;
@@ -98,7 +101,17 @@ private void processCoverage(ExecutionEnvironment env) {
98101 }
99102 }
100103 else {
101- LOG .error (FlutterBundle .message ("coverage.path.not.found" , path ));
104+ LOG .error (FlutterBundle .message ("coverage.path.not.found" , getSafePath ( path ) ));
102105 }
103106 }
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+ }
104117}
0 commit comments