List of usage examples for org.apache.commons.exec OS isFamilyUnix
public static boolean isFamilyUnix()
From source file:Utility.Platform.java
/** * Returns the name of the text editor according to operating system. * <br> note: empty string returned if OS name does not start with Linux or * Windows.//www . j a v a 2 s.c o m * * @return name of text editor as per OS */ public static String getTextEditor() { m_textEditor = ""; if (OS.isFamilyUnix()) { m_textEditor = "gedit"; } else if (OS.isFamilyWindows()) { m_textEditor = "notepad.exe"; } return m_textEditor; }
From source file:Utility.Platform.java
/** * Adds commands to list according to operating system and returns the list. * * @return {@code ArrayList<String>} of commands as per OS *//*www .j av a2 s . c om*/ public static ArrayList<String> getCommandList() { if (OS.isFamilyUnix()) { /* Linux system */ m_commandList.add("(Select command)"); m_commandList.add("cat"); m_commandList.add("chmod"); m_commandList.add("cp"); m_commandList.add("ftp"); m_commandList.add("gcc"); m_commandList.add("ls"); m_commandList.add("mkdir"); m_commandList.add("netstat"); m_commandList.add("nmap"); m_commandList.add("ping"); m_commandList.add("rm"); m_commandList.add("rsync"); m_commandList.add("scp"); m_commandList.add("traceroute"); m_commandList.add("wc"); } else if (OS.isFamilyWindows()) { /* Windows system */ m_commandList.add("(Select command)"); m_commandList.add("assoc"); m_commandList.add("copy"); m_commandList.add("date"); m_commandList.add("del"); m_commandList.add("dir"); m_commandList.add("echo"); m_commandList.add("erase"); m_commandList.add("fc"); m_commandList.add("findstr"); m_commandList.add("help"); m_commandList.add("md"); m_commandList.add("mkdir"); m_commandList.add("move"); m_commandList.add("netstat"); m_commandList.add("ping"); m_commandList.add("rd"); m_commandList.add("ren"); m_commandList.add("tasklist"); m_commandList.add("time"); m_commandList.add("type"); m_commandList.add("ver"); m_commandList.add("vol"); } return m_commandList; }
From source file:Utility.Platform.java
/** * Returns list of options for a given {@code command}. * <br> note: null is returned if OS is neither Linux nor Windows. * * @param command name of command whose option list ({@code String} array) * is returned// w w w . j a v a 2 s . c om * @return {@code String[]} containing options corresponding to * {@code command} */ public static String[] getOptionList(String command) { String[] optionList; if (OS.isFamilyUnix()) { optionList = getLinuxOptionList(command); } else if (OS.isFamilyWindows()) { optionList = getWindowsOptionList(command); } else { return null; } return optionList; }