package jetbrains.mps.vcs.platform.mergedriver;
/*Generated by MPS */
import java.io.File;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.application.PathManager;
import jetbrains.mps.vcs.core.mergedriver.MergeDriverMain;
public class CommandLineGenerator {
private CommandLineGenerator() {
}
public static String getCommandLine(int vcs) {
String classpathString = MergeDriverPacker.getInstance().getPath() + File.separator + '*';
String javaExecutable = System.getProperty("java.home") + File.separator + "bin" + File.separator + "java";
if (SystemInfo.isWindows) {
javaExecutable = adaptPathForMsysGit(javaExecutable + ".exe");
classpathString = classpathString + ";";
}
String escapedLogPath = (PathManager.getLogPath() + File.separator + "mergedriver.log").replace("\\", "\\\\");
return String.format("\"%s\" -ea -D%s=\"%s\" -cp \"%s\" %s", javaExecutable, MergeDriverMain.LOG_PROPERTY, escapedLogPath, classpathString, MergeDriverMain.class.getName());
}
/*package*/ static String adaptPathForMsysGit(String path) {
return path.replaceFirst("^(\\w):\\\\", "/$1/").replace('\\', '/');
}
}