File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
lib/src/main/java/com/diffplug/spotless/java Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 1919import java .io .Serializable ;
2020import java .lang .reflect .Constructor ;
2121import java .lang .reflect .Method ;
22+ import java .nio .file .Path ;
2223import java .util .List ;
2324import java .util .Objects ;
2425
@@ -177,7 +178,8 @@ public String apply(String input) throws Exception {
177178 public String apply (String input , File file ) throws Exception {
178179 if (file .isAbsolute ()) {
179180 // Cleanthat expects a relative file as input (relative to the root of the repository)
180- file = new File ("." , file .getPath ());
181+ Path absolutePath = file .toPath ();
182+ file = absolutePath .subpath (1 , absolutePath .getNameCount ()).toFile ();
181183 }
182184 return (String ) formatterMethod .invoke (formatter , input , file );
183185 }
You can’t perform that action at this time.
0 commit comments