Skip to content

Commit 3db0383

Browse files
committed
Файлы из ресурсов теперь берутся по абсолютному пути, а не через getResource()
1 parent a5922bf commit 3db0383

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/main/java/com/github/leo_proger/config/CoordsConfigurer.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,10 @@ public void configure() throws IOException, URISyntaxException {
6868
}
6969

7070
private void focusOnApp() throws IOException, URISyntaxException {
71-
URL url = CoordsConfigurer.class.getClassLoader().getResource("com/github/leo_proger/focusOnWindow.vbs");
72-
if (url == null)
73-
{
74-
throw new IllegalStateException("ОШИБКА: Файл из ресурсов не найден");
75-
}
76-
Path scriptFile = Path.of(url.toURI());
77-
String scriptPath = scriptFile.toAbsolutePath().toString();
71+
Path scriptPath = Path.of(System.getProperty("user.dir"), "resources", "focusOnWindow.vbs").toAbsolutePath();
7872

7973
Runtime.getRuntime().exec(new String[]{
80-
"wscript.exe", scriptPath
74+
"wscript.exe", scriptPath.toString()
8175
});
8276
}
8377

0 commit comments

Comments
 (0)