protected String[] escapePaths(String srcPath, String dstPath) { srcPath = srcPath.trim(); dstPath = dstPath.trim(); String os = System.getProperty("os.name").toLowerCase(); if (os != null && os.indexOf("windows") > -1) { srcPath = "\"" + srcPath + "\""; dstPath = "\"" + dstPath + "\""; } else { int lastidx = -1, curridx; StringBuffer buff = new StringBuffer(srcPath); while ((curridx = buff.indexOf(" ", lastidx)) > 0) { buff.insert(curridx, "\\"); lastidx = curridx + 2; } srcPath = buff.toString(); buff = new StringBuffer(dstPath); lastidx = -1; while ((curridx = buff.indexOf(" ", lastidx)) > 0) { buff.insert(curridx, "\\"); lastidx = curridx + 2; } dstPath = buff.toString(); } return new String[] {srcPath, dstPath}; }