-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Show a clear error on -o pointing to an invalid directory. fixes #8549 #8551
Conversation
emcc.py
Outdated
# target is just a basename, then dirname is '', which os.path.exists would | ||
# report as not existing) | ||
dirname = os.path.dirname(target) | ||
if dirname and not os.path.exists(dirname): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be more specific here and use "os.path.isdir(dirname)".
# (note that we must check that dirname is not the empty string - if the | ||
# target is just a basename, then dirname is '', which os.path.exists would | ||
# report as not existing) | ||
dirname = os.path.dirname(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the final sentence in brackets is necessary. It obvious enough (I think) what if dirname and not os.path.exists(dirname):
is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the following comment
Check for the existence of the output directory now, to avoid having to do so repeatedly when each of the various output files (.mem, .wasm, etc) is written. This gives a more useful error message than the IOError and python backtrace that users would otherwise see.
For reference the way native toolchains report this (both clang and gcc) is:
|
Thanks for the feedback @sbc100 , should be addressed now. |
…ripten-core#8549 (emscripten-core#8551) Without this, Python will give an error "no such file" when we try to write to that file, which can be confusing. Worse, this will happen on the first file we try to write to, which may be one of the helper files (.wasm, .mem, etc.), which is even more confusing.
…ripten-core#8549 (emscripten-core#8551) Without this, Python will give an error "no such file" when we try to write to that file, which can be confusing. Worse, this will happen on the first file we try to write to, which may be one of the helper files (.wasm, .mem, etc.), which is even more confusing.
Without this, Python will give an error "no such file" when we try to write to that file, which can be confusing. Worse, this will happen on the first file we try to write to, which may be one of the helper files (.wasm, .mem, etc.), which is even more confusing.