|
@@ -22,16 +22,15 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.updater.components;
|
24
|
24
|
|
|
25
|
+import com.dmdirc.Main;
|
25
|
26
|
import com.dmdirc.interfaces.config.IdentityController;
|
26
|
27
|
import com.dmdirc.ui.StatusMessage;
|
27
|
28
|
import com.dmdirc.ui.core.components.StatusBarManager;
|
28
|
29
|
import com.dmdirc.updater.UpdateComponent;
|
29
|
30
|
import com.dmdirc.updater.Version;
|
|
31
|
+import com.dmdirc.util.io.FileUtils;
|
30
|
32
|
|
31
|
33
|
import java.io.File;
|
32
|
|
-import java.net.URISyntaxException;
|
33
|
|
-import java.nio.file.Path;
|
34
|
|
-import java.nio.file.Paths;
|
35
|
34
|
|
36
|
35
|
import javax.inject.Inject;
|
37
|
36
|
|
|
@@ -90,23 +89,14 @@ public class ClientComponent implements UpdateComponent {
|
90
|
89
|
+ File.separator + ".DMDirc.jar");
|
91
|
90
|
|
92
|
91
|
if (requiresManualInstall()) {
|
93
|
|
- Path appPath;
|
94
|
|
- String appDir;
|
95
|
|
- try {
|
96
|
|
- appPath = Paths.get(getClass().getProtectionDomain().getCodeSource()
|
97
|
|
- .getLocation().toURI());
|
98
|
|
- appDir = appPath.toAbsolutePath().toString();
|
99
|
|
- } catch (URISyntaxException e) {
|
100
|
|
- appPath = null;
|
101
|
|
- appDir = "[Error getting path]";
|
102
|
|
- }
|
103
|
|
- if (appPath != null && appPath.getFileName().endsWith(".jar")) {
|
|
92
|
+ if (FileUtils.isRunningFromJar(Main.class)) {
|
104
|
93
|
return "A new version of DMDirc has been downloaded, but as you\n"
|
105
|
94
|
+ "do not seem to be using the DMDirc launcher, it will\n"
|
106
|
95
|
+ "not be installed automatically.\n\n"
|
107
|
96
|
+ "To install this update manually, please replace the\n"
|
108
|
97
|
+ "existing DMDirc.jar file, located at:\n"
|
109
|
|
- + " " + appDir + "\n with the following file:\n "
|
|
98
|
+ + " " + FileUtils.getApplicationPath(Main.class)
|
|
99
|
+ + "\n with the following file:\n "
|
110
|
100
|
+ targetFile.getAbsolutePath();
|
111
|
101
|
} else {
|
112
|
102
|
return "A new version of DMDirc has been downloaded, but as you\n"
|
|
@@ -116,7 +106,7 @@ public class ClientComponent implements UpdateComponent {
|
116
|
106
|
+ "new DMDirc.jar file, located at:\n"
|
117
|
107
|
+ " " + targetFile.getAbsolutePath() + "\n"
|
118
|
108
|
+ "over your existing DMDirc install located in:\n"
|
119
|
|
- + " " + appDir;
|
|
109
|
+ + " " + FileUtils.getApplicationPath(Main.class);
|
120
|
110
|
}
|
121
|
111
|
}
|
122
|
112
|
return "";
|