Android,Bluestacks:"打开失败:EISDIR(是一个目录)"

时间:2014-06-26 23:03:20

标签: java android bluestacks

我得到了open failed: EISDIR (Is a directory)。我从中找到的所有解决方案都说要调用file.getParentFile().mkdirs(),但我仍然遇到了这个错误。它打印出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();
        }

1 个答案:

答案 0 :(得分:1)

好的,我找到了答案。我可能正在尝试写入Bluestacks中不存在的文件夹。这是有用的:

String base = Environment.getExternalStorageDirectory().getAbsolutePath() + "/bstfolder/BstSharedFolder/";

然后可以在Windows中从C:\ProgramData\BlueStacks\UserData\SharedFolder

访问该文件夹