/** * @param in in[2..] - name in[1] - path * @return */ public boolean mkdir(String[] in) { if (in.length < 3) { report("\'mkdir\' should have at least 2 args", true); return false; } MyLittleArchivator.ZipFolder cur = getDir(in[1]); if (cur == null) { return false; } // TODO validate folder name for (int i = 2; i < in.length; i++) { cur.add(new MyLittleArchivator.ZipFolder(in[i])); } System.out.print("> "); return true; }
public boolean add(String[] in) { if (in.length < 2) { report("\'add\' should have at least 2 argument.", true); return false; } MyLittleArchivator.ZipFolder cur = getDir(in[1]); if (cur == null) { return false; } for (int i = 2; i < in.length; i++) { File file = new File(in[i]); if (file.canRead() && file.isFile()) { cur.add(file); System.out.println("Adding " + file.getName()); } else { report("Can't read: " + in[i], true); return false; } } System.out.print("> "); return true; }