* @return null if not found
*/
public static String directoryForWrite(String path) {
if (path == null) return null;
File file = new File(path);
if (file.isDirectory() && file.canWrite()) {
return path;
}
if (file.getParentFile() == null) return null;
String parent = file.getParentFile().getAbsolutePath();
if (parent == null) return null;