import org.tizen.dynamicanalyzer.ui.toolbar.StartProcessManager;
import org.tizen.dynamicanalyzer.ui.toolbar.ToolbarArea;
import org.tizen.dynamicanalyzer.util.ByteUtil;
+import org.tizen.dynamicanalyzer.util.CommonUtil;
import org.tizen.dynamicanalyzer.util.DALogger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
String[] splitLocalBinaryPath = localBinaryPath
.split(CommonConstants.SLASH);
- // check local binary path validation
- if (splitLocalBinaryPath.length < 3) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
- binInfo.setTempBinaryPath(localBinaryPath);
- }
- } else {
- // host has no binary file - pull binary file from target
- // change binary file path of host
- File binFile = new File(localBinaryPath);
- if (!binFile.exists()) {
+ if (CommonUtil.isLinux()) {
+ // check local binary path validation
+ if (splitLocalBinaryPath.length < 3) {
localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ File.separator + getFileName(targetPath);
result = pullTheFile(targetPath, localBinaryPath);
binInfo.setTempBinaryPath(localBinaryPath);
}
} else {
- // if local binary exist already, then check for md5sum
- String localHashCode = null;
- try {
- Runtime rt = Runtime.getRuntime();
- Process process = rt.exec(new String[] {
- AnalyzerShellCommands.CMD_MD_5_SUM,
- localBinaryPath });
- process.waitFor();
- BufferedReader reader = new BufferedReader(
- new InputStreamReader(process.getInputStream()));
- BufferedReader error = new BufferedReader(
- new InputStreamReader(process.getErrorStream()));
- String line = reader.readLine();
- String errorStr = error.readLine();
- if (null == line) {
- DA_LOG.debug("host md5sum get failed : " + errorStr);
+ // host has no binary file - pull binary file from target
+ // change binary file path of host
+ File binFile = new File(localBinaryPath);
+ if (!binFile.exists()) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
+ // if local binary exist already, then check for md5sum
+ String localHashCode = null;
+ try {
+ Runtime rt = Runtime.getRuntime();
+ Process process = rt.exec(new String[] {
+ AnalyzerShellCommands.CMD_MD_5_SUM,
+ localBinaryPath });
+ process.waitFor();
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(
+ process.getInputStream()));
+ BufferedReader error = new BufferedReader(
+ new InputStreamReader(
+ process.getErrorStream()));
+ String line = reader.readLine();
+ String errorStr = error.readLine();
+ if (null == line) {
+ DA_LOG.debug("host md5sum get failed : "
+ + errorStr);
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } else {
+ String[] splitResult = line.trim().split(
+ CommonConstants.SPACE);
+ localHashCode = new String(splitResult[0]);
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ result = HostResult.ERR_BIN_INFO_GET_FAIL;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
result = HostResult.ERR_BIN_INFO_GET_FAIL;
- } else {
- String[] splitResult = line.trim().split(
- CommonConstants.SPACE);
- localHashCode = new String(splitResult[0]);
}
- } catch (IOException e) {
- e.printStackTrace();
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- } catch (InterruptedException e) {
- e.printStackTrace();
- result = HostResult.ERR_BIN_INFO_GET_FAIL;
- }
- if (localHashCode != null) {
- String targetHashCode = binInfo.getMd5sumValue();
- if (0 != targetHashCode.compareTo(localHashCode)) {
- localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
- + File.separator + getFileName(targetPath);
- result = pullTheFile(targetPath, localBinaryPath);
- if (result.isSuccess()) {
+ if (localHashCode != null) {
+ String targetHashCode = binInfo.getMd5sumValue();
+ if (0 != targetHashCode.compareTo(localHashCode)) {
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator
+ + getFileName(targetPath);
+ result = pullTheFile(targetPath,
+ localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
+ } else {
binInfo.setTempBinaryPath(localBinaryPath);
}
- } else {
- binInfo.setTempBinaryPath(localBinaryPath);
}
}
}
+ } else { // if not linux
+ localBinaryPath = PathManager.DA_TEMP_FOLDER_PATH
+ + File.separator + getFileName(targetPath);
+ result = pullTheFile(targetPath, localBinaryPath);
+ if (result.isSuccess()) {
+ binInfo.setTempBinaryPath(localBinaryPath);
+ }
}
}
return result;