<small id='4Ceog'></small><noframes id='4Ceog'>

      • <bdo id='4Ceog'></bdo><ul id='4Ceog'></ul>
      <legend id='4Ceog'><style id='4Ceog'><dir id='4Ceog'><q id='4Ceog'></q></dir></style></legend>
    1. <i id='4Ceog'><tr id='4Ceog'><dt id='4Ceog'><q id='4Ceog'><span id='4Ceog'><b id='4Ceog'><form id='4Ceog'><ins id='4Ceog'></ins><ul id='4Ceog'></ul><sub id='4Ceog'></sub></form><legend id='4Ceog'></legend><bdo id='4Ceog'><pre id='4Ceog'><center id='4Ceog'></center></pre></bdo></b><th id='4Ceog'></th></span></q></dt></tr></i><div id='4Ceog'><tfoot id='4Ceog'></tfoot><dl id='4Ceog'><fieldset id='4Ceog'></fieldset></dl></div>
      <tfoot id='4Ceog'></tfoot>

        Libgdx 如何获取目录中的文件列表?

        时间:2023-05-20
            • <tfoot id='zsQRn'></tfoot>

                <bdo id='zsQRn'></bdo><ul id='zsQRn'></ul>
                  <tbody id='zsQRn'></tbody>

                <small id='zsQRn'></small><noframes id='zsQRn'>

              • <i id='zsQRn'><tr id='zsQRn'><dt id='zsQRn'><q id='zsQRn'><span id='zsQRn'><b id='zsQRn'><form id='zsQRn'><ins id='zsQRn'></ins><ul id='zsQRn'></ul><sub id='zsQRn'></sub></form><legend id='zsQRn'></legend><bdo id='zsQRn'><pre id='zsQRn'><center id='zsQRn'></center></pre></bdo></b><th id='zsQRn'></th></span></q></dt></tr></i><div id='zsQRn'><tfoot id='zsQRn'></tfoot><dl id='zsQRn'><fieldset id='zsQRn'></fieldset></dl></div>
                <legend id='zsQRn'><style id='zsQRn'><dir id='zsQRn'><q id='zsQRn'></q></dir></style></legend>

                  本文介绍了Libgdx 如何获取目录中的文件列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  所以我尝试使用文件 handle.list() 方法获取目录中的文件列表,但即使目录中有文件,它也会返回一个空列表.对我来说奇怪的是它可以在设备上工作,但不能在桌面上工作.我想我知道问题是什么,但我不知道如何解决它.在方法描述中它说在桌面上,类路径上目录的 FileType.Internal 句柄将返回一个零长度数组."但是除了这个之外没有其他方法,所以你们认为我能做什么?

                  So I am trying to get a list of files in a directory with a file handle.list() method but it returns an empty list even though there are files in the directory. What seems strange to me is that it does work on the device but it does not work on the desktop. I think I know what the problem is but I dont know how to solve it though. In the method description it says "On the desktop, an FileType.Internal handle to a directory on the classpath will return a zero length array.", but there is no other method than this so what do you guys think I can do?

                  推荐答案

                  内部文件"是在桌面运行时通过类路径找到的,所以没有简单的方法可以在类路径中列出"一个目录.如果您只是使用桌面进行开发,并且不介意一些 hack,您可以在./bin/"中搜索丢失的文件.

                  The "internal files" are found via the classpath when run on the desktop, so there is no simple way to "list" a directory in the classpath. If you're just using the desktop for development, and don't mind some hacks you can search "./bin/" for the missing files.

                  像这样:

                  FileHandle dirHandle;
                  if (Gdx.app.getType() == ApplicationType.Android) {
                     dirHandle = Gdx.files.internal("some/directory");
                  } else {
                    // ApplicationType.Desktop ..
                    dirHandle = Gdx.files.internal("./bin/some/directory");
                  }
                  for (FileHandle entry: dirHandle.list()) {
                     // yadda ...
                  }
                  

                  有关更多详细信息,请参阅:http://bitiotic.com/blog/2012/05/15/libgdx-internal-files-hacks/

                  For a bit more detail, see: http://bitiotic.com/blog/2012/05/15/libgdx-internal-files-hacks/

                  更新:这不再正确.不必添加./bin/"路径前缀 - 无需添加即可正常工作,添加后无法正常工作.所以这个解决方案已经过时了.

                  Update: this is not correct any more. That "./bin/" path prefix don't have to be added - works well without adding it and not working when it's added. So this solution is obsolete.

                  这篇关于Libgdx 如何获取目录中的文件列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:android.os.Bundle 无法在 libgdx Android 项目中解析 下一篇:在 Libgdx 中绘制渐变

                  相关文章

                  最新文章

                    <legend id='5xwn7'><style id='5xwn7'><dir id='5xwn7'><q id='5xwn7'></q></dir></style></legend>
                    1. <small id='5xwn7'></small><noframes id='5xwn7'>

                    2. <tfoot id='5xwn7'></tfoot>
                      <i id='5xwn7'><tr id='5xwn7'><dt id='5xwn7'><q id='5xwn7'><span id='5xwn7'><b id='5xwn7'><form id='5xwn7'><ins id='5xwn7'></ins><ul id='5xwn7'></ul><sub id='5xwn7'></sub></form><legend id='5xwn7'></legend><bdo id='5xwn7'><pre id='5xwn7'><center id='5xwn7'></center></pre></bdo></b><th id='5xwn7'></th></span></q></dt></tr></i><div id='5xwn7'><tfoot id='5xwn7'></tfoot><dl id='5xwn7'><fieldset id='5xwn7'></fieldset></dl></div>

                      • <bdo id='5xwn7'></bdo><ul id='5xwn7'></ul>