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

Opening file with open_writer(Append) throws an Error #10121

Closed
d3xter opened this issue Oct 28, 2013 · 3 comments
Closed

Opening file with open_writer(Append) throws an Error #10121

d3xter opened this issue Oct 28, 2013 · 3 comments

Comments

@d3xter
Copy link

d3xter commented Oct 28, 2013

When I open a File with the FileMode "Append",
rust throws an Error if the file doesnt exist, although
the documentation says that it should be created automatically:

Example:

let path = Path::new::<~str>(~"file.txt");
path.open_writer(Append);

Error:

task '<unnamed>' failed at 'Unhandled condition: io_error: std::rt::io::IoError{kind: OtherIoError, desc: "no such file or directory", detail: None}
@alexcrichton
Copy link
Member

Looking at the documentation, it doesn't seem to state that this is the intended behavior. Could you point me at the documentation which says that this should be allowed?

@d3xter
Copy link
Author

d3xter commented Oct 30, 2013

http://static.rust-lang.org/doc/master/std/rt/io/enum.FileMode.html
There it says "Append: Opens an existing file or creates a new one, positioned at EOF."

@alexcrichton
Copy link
Member

Ah thanks! I wonder if we shouldn't have Create or CreateOrTruncate and have the file always created on write access with the possible modes of Open, Append, or Truncate...

Regardless, I hope to fix this soon!

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

No branches or pull requests

2 participants