/** * Convenience method for copy all files. Does not use default-excludes * @return list of files and directories created */ public List<Node> copyDirectory(Node dest) throws DirectoryNotFoundException, CopyException { return copyDirectory(dest, new Filter().includeAll()); }
/** * Copies this to dest. Overwrites existing file and adds to existing directories. * * @throws NodeNotFoundException if this does not exist */ public void copy(Node dest) throws NodeNotFoundException, CopyException { try { if (isDirectory()) { dest.mkdirOpt(); copyDirectory(dest); } else { copyFile(dest); } } catch (FileNotFoundException | CopyException e) { throw e; } catch (IOException e) { throw new CopyException(this, dest, e); } }
/** generate file hierarchy for Debian package */ public static void main(String[] args) throws Exception { World world; FileNode target; FileNode man; FileNode profileD; Home home; if (args.length != 1) { throw new IllegalArgumentException(); } world = World.create(); target = world.file(args[0]); target.mkdir(); man = target.join("usr/share/man"); man.mkdirs(); world.resource("templates/man").copyDirectory(man); profileD = target.join("etc/profile.d"); profileD.mkdirs(); home = new Home(Environment.loadSystem(), Console.create(), target, null); home.profile(profileD.join("stool.sh"), ""); home.bashComplete(target.join("etc/bash_completion.d").mkdirs().join("stool")); System.exit(0); } }
public void create() throws IOException { World world; Gson gson; StoolConfiguration conf; gson = gson(); dir.mkdir(); world = dir.getWorld(); world.resource("files/home").copyDirectory(dir); for (String name : new String[]{"backstages", "logs", "run", "system", "downloads"}) { dir.join(name).mkdir(); } profile(dir.join("shell.rc"), file("files/sourceBashComplete")); bashComplete(dir.join("bash.complete")); conf = Autoconf.stool(environment, dir,console.info); if (explicitConfig != null) { conf = conf.createPatched(gson, explicitConfig); } conf.save(gson, dir); versionFile().writeString(Main.versionString(world)); dir.join("run/locks").mkfile(); }