blob: cb8a95dd8348b5176e2f61638b7bfbcda483d7d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package org.javacs;
import java.net.URI;
import java.nio.file.Paths;
/** Find java sources in test-project/workspace/src */
public class FindResource {
public static URI uri(String resourcePath) {
if (resourcePath.startsWith("/")) resourcePath = resourcePath.substring(1);
var path = Paths.get("./src/test/test-project/workspace/src").resolve(resourcePath).normalize();
var file = path.toFile();
if (!file.exists()) throw new RuntimeException(file + " does not exist");
return file.toURI();
}
}
|