I have tried to make sense of the getFileStreamPath madness for some hours now. Could someone please explain how to test if a path = "shop/crates/fruits" exists? In an attempt to simplify the test i have broken the path in to segments. I thought i had it. But the test breaks when shop exists but there is no crates..Weird! Or is it?
public static Boolean pathExists(String path, Context ctx)
{
Boolean result = false;
String[] pathSegments = path.split("/");
String pathStr = "";
for(int i = 0;i<pathSegments.length;i++ )
{
pathStr += pathSegments[i];
if(!ctx.getFileStreamPath(pathStr).exists())
{
result = false;
break;
}
pathStr += "/";
result = true;
}
return result;
}