package com.hand.mas.ant.util;

public class SysExcUtil {
	
	private static String[] getCmdInitArr(){
		if(System.getProperty("os.name").contains("Linux")){
			return new String[]{};
		}else if(System.getProperty("os.name").contains("Windows")){
			return new String[]{"cmd.exe"," /c"};
		}
		return new String[]{};
	}
	
	public static String[] getCmd(String[] cmdArray){
		String cmdInitArr[] = getCmdInitArr();
		String cmd[] = new String[cmdInitArr.length + cmdArray.length];
		for(int i = 0; i < cmdInitArr.length;i ++){
			cmd[i] = cmdInitArr[i];
		}
		for(int j = 0; j < cmdArray.length ;  j ++){
			cmd[cmdInitArr.length + j] = cmdArray[j];
		}
		return cmd;
	}
	
	public static String[] getCmd(String command){
		String cmdInitArr[] = getCmdInitArr();
		String cmd[] = new String[cmdInitArr.length + 1];
		for(int i = 0; i < cmdInitArr.length;i ++){
			cmd[i] = cmdInitArr[i];
		}
		cmd[cmdInitArr.length] = command;
		return cmd;
	}
}
