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 19
19
import java .io .Serializable ;
20
20
import java .lang .reflect .Constructor ;
21
21
import java .lang .reflect .Method ;
22
+ import java .nio .file .Path ;
22
23
import java .util .List ;
23
24
import java .util .Objects ;
24
25
@@ -177,7 +178,8 @@ public String apply(String input) throws Exception {
177
178
public String apply (String input , File file ) throws Exception {
178
179
if (file .isAbsolute ()) {
179
180
// 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 ();
181
183
}
182
184
return (String ) formatterMethod .invoke (formatter , input , file );
183
185
}
You can’t perform that action at this time.
0 commit comments