-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FileHandle#exists() doesn't close resource on iOS #2345
Comments
This looks like it is deep within the depths of the runtime. The |
I agree, that's what the stack trace says. EDIT: |
Fwiw, the file referenced does exist when this is happening. |
@mikemee |
@davebaol Happy to test on my system where this repros (I'm the Michael referenced). Can you expand on: Using FileHandler.exists() directly would be a good test. and I'll give it a try? |
@mikemee public class FileHandleExistsTest extends ApplicationAdapter {
@Override
public void create () {
FileHandle fh = Gdx.files.internal("my_file");
if (fh.exists())
Gdx.app.log("FileHandleExistsTest", "File exists");
else
Gdx.app.log("FileHandleExistsTest", "File doesn't exist");
Gdx.app.exit();
}
} Run it with and without my_file in assets folder. EDIT: |
First attempt, without the file existing:
This was followed by a successful attempt when the file did exist (i tried it 3 times to be sure - with the file missing it failed on the first attempt):
|
Thanks for the verification. |
No worries. Loving this framework and it's working out well for my company. So I want to take the time to give back in all ways possible. Too easy to 'let someone else worry about it'. I was able to build libgdx not too long ago, so if/when there's a proposed fix, I'm happy to try it. |
So, we verified that the warning shows only when a file does not exist, and that it is a result of the underlying runtime not closing some stream it creates when determining if that file exists? If that's the case, it sounds like something that we should close as not a libgdx defect. |
Yes that's exactly the case. |
The reason for the fallback is that when internal files are bundled into the jar (or iOS app, it seems), they become resources instead of files. I'll go ahead and close this out since it isn't actually a libgdx defect. |
IIRC robovm uses the java runtime from android. So it might be a robovm issue or a android runtime issue. |
Calling
FileHandle#exists()
(internal file) on iOS seems to forget closing a resource.Since I don't have an iOS device I can't try if
FileHandle#exists()
alone triggers this, so I can currently only assure this happens when loading anI18NBundle
. Here's some code to replicate:Put this into your assets folder as
i18nStub.properties
:key=value
This should load the bundle, print
key: value
to the console and exit.Some more information from @mikemee who tested on an iOS device:
The text was updated successfully, but these errors were encountered: