package retrobox.utils;

import java.io.File;

import xtvapps.core.Utils;

public class MountPoint {
	File dir;
	String description;
	String filesystem = "unknown";
	
	public MountPoint(String path) {
		this.dir = new File(path);
	}
	
	public MountPoint(File dir) {
		this.dir = dir;
	}

	public MountPoint() {
	}

	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public boolean isValid() {
		return dir!=null;
	}

	public long getFreeSpace() {
		return dir==null?0:dir.getFreeSpace();
	}
	
	public long getTotalSpace() {
		return dir==null?0:dir.getTotalSpace();
	}

	public File getDir() {
		return dir;
	}

	public String getFilesystem() {
		return filesystem;
	}

	public void setFilesystem(String filesystem) {
		this.filesystem = filesystem;
	}

	public String getFriendlyFreeSpace() {
		return Utils.size2humanDetailed(getFreeSpace()) + " free of " + Utils.size2humanDetailed(getTotalSpace());
	}
	
	@Override
	public String toString() {
		return String.format("path:%s, desc:%s", dir!=null?dir.getAbsolutePath():"null", description);
	}
	
}

@@ -158,16 +158,45 @@
 known%22;%0A
+%09boolean isWritable = false;%0A
 %09%0A%09publi
@@ -1026,16 +1026,157 @@
 );%0A%09%7D%0A%09%0A
+%09%0A%09public boolean isWritable() %7B%0A%09%09return isWritable;%0A%09%7D%0A%0A%09public void setWritable(boolean isWritable) %7B%0A%09%09this.isWritable = isWritable;%0A%09%7D%0A%0A
 %09@Overri

Allow setting a flag for writable / non writable folders