Commit 43121495 authored by Ilya.Kazakevich's avatar Ilya.Kazakevich
Browse files

IDEA-85995: Remove unneeded code and constant

parent 201eef78
Showing with 3 additions and 44 deletions
+3 -44
......@@ -150,7 +150,7 @@ public class ExecUtil {
final GeneralCommandLine sudoCommandLine;
if (SystemInfo.isWinVistaOrNewer) {
// launcher.exe process with elevated permissions on UAC.
final File launcherExe = PathManager.findBinFileWithException(PathManager.WIN_LAUNCHER);
final File launcherExe = PathManager.findBinFileWithException("launcher.exe");
sudoCommandLine = new GeneralCommandLine(launcherExe.getPath());
sudoCommandLine.setWorkDirectory(commandLine.getWorkDirectory());
sudoCommandLine.addParameter(commandLine.getExePath());
......
......@@ -136,7 +136,7 @@ object UpdateInstaller {
if (SystemInfo.isWindows) {
// launcher depends on elevator
val launcher = PathManager.findBinFile(PathManager.WIN_LAUNCHER)
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
......
......@@ -55,10 +55,6 @@ public class PathManager {
public static final String PROPERTY_LOG_PATH = "idea.log.path";
public static final String PROPERTY_PATHS_SELECTOR = "idea.paths.selector";
public static final String DEFAULT_OPTIONS_FILE_NAME = "other";
/**
* Tool to launch any command under UAC
*/
public static final String WIN_LAUNCHER = "launcher.exe";
private static final String PROPERTY_HOME = "idea.home"; // reduced variant of PROPERTY_HOME_PATH, now deprecated
......
......@@ -480,17 +480,7 @@ public class FileUtil extends FileUtilRt {
@SuppressWarnings("Duplicates")
private static void performCopy(@NotNull File fromFile, @NotNull File toFile, final boolean syncTimestamp) throws IOException {
if (filesEqual(fromFile, toFile)) return;
final FileOutputStream fos;
try {
fos = openOutputStream(toFile);
}
catch (IOException e) {
if (SystemInfo.isWindows && e.getMessage() != null && e.getMessage().contains("denied") &&
nativeWindowsCopy(fromFile, toFile)) {
return;
}
throw e;
}
final FileOutputStream fos = openOutputStream(toFile);
try {
final FileInputStream fis = new FileInputStream(fromFile);
......@@ -520,33 +510,6 @@ public class FileUtil extends FileUtilRt {
}
}
private static boolean nativeWindowsCopy(@NotNull final File src, @NotNull final File dst) {
final File launcher = PathManager.findBinFile(PathManager.WIN_LAUNCHER);
if (launcher == null || !launcher.exists()) {
return false;
}
try {
final ProcessBuilder builder =
new ProcessBuilder(launcher.getAbsolutePath(), "cmd.exe", "/C", "copy", src.getAbsolutePath(), dst.getAbsolutePath());
final Process process = builder.start();
final String error = StreamUtil.readText(process.getErrorStream(), Charset.defaultCharset());
final String out = StreamUtil.readText(process.getInputStream(), Charset.defaultCharset());
LOG.info("out" + out);
LOG.info("error" + error);
return process.waitFor() == 0;
}
catch (final IOException ex) {
LOG.warn(ex);
return false;
}
catch (final InterruptedException ex) {
LOG.warn(ex);
return false;
}
}
private static FileOutputStream openOutputStream(@NotNull final File file) throws IOException {
try {
return new FileOutputStream(file);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment