-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Make std::env::current_dir
work for path names longer than 2048 bytes on non-Windows
#26896
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
Conversation
…es on non-Windows
r? @huonw (rust_highfive has picked a reviewer for you, use r? to override) |
} | ||
} | ||
} | ||
} |
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.
This function actually primarily exists on Windows due to the utf-16 to wtf-8 conversion because it allows us to use a u16 stack buffer first and avoid the extra heap allocation unless necessary. On Unix, however, we shouldn't need this function because the same byte buffer filled in by the OS can be converted directly into an OsString
.
@alexcrichton Addressed your comments. |
Ok(PathBuf::from(OsString::from_bytes(buf).unwrap())) | ||
} else { | ||
let error = io::Error::last_os_error(); | ||
if error.raw_os_error().unwrap() == libc::ERANGE { |
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.
While unwrap()
will always succeed, it's not idiomatic, so let's compare against Some(libc::ERANGE)
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.
Abandoning sanity-checking for idomatic code is not something I'd like to do, but since you insist, I'll change it.
@alexcrichton Addressed all of your comments despite being unhappy with one. |
💔 Test failed - auto-win-gnu-64-opt |
@bors: retry On Fri, Jul 10, 2015 at 10:54 AM, bors notifications@github.com wrote:
|
⚡ Previous build results for auto-linux-32-nopt-t, auto-linux-64-nopt-t, auto-linux-64-opt, auto-mac-32-opt, auto-mac-64-nopt-t, auto-mac-64-opt, auto-win-gnu-32-nopt-t, auto-win-gnu-32-opt, auto-win-gnu-64-nopt-t are reusable. Rebuilding only auto-linux-32-opt, auto-linux-64-x-android-t, auto-win-gnu-64-opt... |
(On Windows, it works already.)