Skip to content
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

File class always returns ERR_FILE_CANT_OPEN error instead of actual error #29039

Closed
andy-noisyduck opened this issue May 20, 2019 · 4 comments
Closed
Assignees
Milestone

Comments

@andy-noisyduck
Copy link
Contributor

Godot version:
3.1.1 (Mono)

OS/device including version:
Windows 10

Issue description:
When attempt to open a file using the File.open(...) method, if an error occurs (such as a missing file) the return error will always be ERR_FILE_CANT_OPEN. It is not possible to determine the more specific error. The expected errors ERR_FILE_NOT_FOUND for a missing file, or ERR_FILE_ALREADY_IN_USE for an exclusively locked file are never returned.

Steps to reproduce:
Open a "valid" but missing file path using File.open. Check the return error value. It will always be 12 (the error code for the generic ERR_FILE_CANT_OPEN error).

Minimal reproduction project:
Testing-FileOpen.zip

@mhilbrunner
Copy link
Member

Yup. I'm currently working on a fix for this :)

@mhilbrunner mhilbrunner added this to the 3.2 milestone May 20, 2019
@mhilbrunner mhilbrunner self-assigned this May 20, 2019
@KoBeWi
Copy link
Member

KoBeWi commented Nov 17, 2019

In 3.2 beta1, ERR_FILE_NOT_FOUND is returned correctly, but ERR_FILE_ALREADY_IN_USE is still not.

@timothyqiu
Copy link
Member

ERR_FILE_ALREADY_IN_USE does not seem to be about "can't open an exclusively locked file". It's more like "there is already something in use", some examples:

Error GDMonoAssembly::load(bool p_refonly) {
ERR_FAIL_COND_V(loaded, ERR_FILE_ALREADY_IN_USE);

Error AudioStreamMPC::_reload() {
ERR_FAIL_COND_V(demux!=NULL, ERR_FILE_ALREADY_IN_USE);

@akien-mga
Copy link
Member

Closing as "good enough" for now, but better error reporting for core APIs can be looked at for 4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants