mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 19:02:13 +07:00
Cleanup (simplification)
This commit is contained in:
+4
-5
@@ -135,12 +135,11 @@ object UpdateInstaller {
|
||||
val args = arrayListOf<String>()
|
||||
|
||||
if (SystemInfo.isWindows) {
|
||||
// launcher depends on elevator
|
||||
val launcher = PathManager.findBinFile("launcher.exe")
|
||||
val elevator = PathManager.findBinFile("elevator.exe")
|
||||
if (launcher !=null && elevator != null && launcher.canExecute()) {
|
||||
args += Restarter.createTempExecutable(launcher, elevator).path
|
||||
|
||||
val elevator = PathManager.findBinFile("elevator.exe") // "launcher" depends on "elevator"
|
||||
if (launcher != null && elevator != null && launcher.canExecute() && elevator.canExecute()) {
|
||||
Restarter.createTempExecutable(elevator)
|
||||
args += Restarter.createTempExecutable(launcher).path
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,7 @@ public class Restarter {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static File createTempExecutable(@NotNull File executable, @NotNull final File ...filesToCopyToSameFolder) throws IOException {
|
||||
public static File createTempExecutable(@NotNull File executable) throws IOException {
|
||||
File tempDir = new File(PathManager.getSystemPath(), "restart");
|
||||
if (!FileUtilRt.createDirectory(tempDir)) {
|
||||
throw new IOException("Cannot create directory: " + tempDir);
|
||||
@@ -224,11 +224,6 @@ public class Restarter {
|
||||
copy = FileUtilRt.createTempFile(tempDir, prefix, suffix, true, false);
|
||||
}
|
||||
FileUtilRt.copy(executable, copy);
|
||||
final File directory = copy.getParentFile();
|
||||
for (final File fileToCopy : filesToCopyToSameFolder) {
|
||||
FileUtilRt.copy(fileToCopy, new File(directory, fileToCopy.getName()));
|
||||
}
|
||||
|
||||
|
||||
if (executable.canExecute() && !copy.setExecutable(true)) {
|
||||
throw new IOException("Cannot make file executable: " + copy);
|
||||
|
||||
Reference in New Issue
Block a user