[英]Android, Bluestacks: “open failed: EISDIR (Is a directory)”
I'm getting open failed: EISDIR (Is a directory)
. 我open failed: EISDIR (Is a directory)
。 All the solutions I've found from that say to call file.getParentFile().mkdirs()
, but I'm still getting that error. 我从中发现的所有解决方案都说可以调用file.getParentFile().mkdirs()
,但是我仍然遇到该错误。 It prints out Good
but also prints out Directory not created
. 它打印出“ Good
但也打印出Directory not created
。
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state))
{
Log.e("test", "Good");
}
File f = Environment.getExternalStorageDirectory();
lvlWriter.writeLevel(f);
. 。
writeLevel(File f)
{
File file = new File(f, "1.txt");
if (!file.getParentFile().mkdirs())
{
Log.e("test", "Directory not created");
}
if (!file.exists())
{
file.createNewFile();
}
Okay, I found the answer. 好吧,我找到了答案。 I was probably trying to write to a folder that doesn't exist in Bluestacks. 我可能正在尝试写入Bluestacks中不存在的文件夹。 This is what does work: 这是起作用的:
String base = Environment.getExternalStorageDirectory().getAbsolutePath() + "/bstfolder/BstSharedFolder/";
And that folder can then be accessed in Windows from C:\\ProgramData\\BlueStacks\\UserData\\SharedFolder
然后可以在Windows中从C:\\ProgramData\\BlueStacks\\UserData\\SharedFolder
访问该文件夹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.