package fileSystem;


public class FileSystem {
	private Directory root, wd;
	public FileSystem(Directory root) {
		this.root = root;
		this.wd = root;
	}
	public Directory getRoot() {
		return root;
	}
	public Directory getWD() {
		return wd;
	}

	public File getFile(String name) {
		return wd.getFile(name);
	}
	
	public Directory getDirectory(String name) {
		return wd.getDirectory(name);
	}
	
	public boolean touch(String name) {
		if (wd.getDirectory(name)!= null || wd.getFile(name) != null)
			return false;
		File f = new File(name);
		wd.add(f);
		return true;
	}
	
	public boolean md(String name) {
		if (wd.getDirectory(name)!= null || wd.getFile(name) != null)
			return false;
		Directory d = new Directory(name);
		wd.add(d);
		return true;
	}
}
