summary refs log tree commit diff
path: root/src/libstd/path.rs
AgeCommit message (Collapse)AuthorLines
2017-11-13Rollup merge of #45892 - redox-os:is_absolute_fix, r=alexcrichtonkennytm-4/+4
Redox: Return true from Path::is_absolute if a Path contains root or a scheme In Redox, different subsystems have different filesystem paths. However, the majority of applications using the `Path::is_absolute` function really only want to know if a path is absolute from the perspective of the scheme it is currently running in, usually `file:`. This makes both `file:/` and `/` return `true` from `Path::is_absolute`, meaning that most code does not have to check if it is running on Redox. Code that wants to know if a path contains a scheme can implement such a check on its own. Related to https://github.com/rust-lang/rust/pull/45893
2017-11-04Allow absolute if either contains root or a schemeJeremy Soller-4/+4
2017-11-03Copy `AsciiExt` methods to `char` directlyLukas Kalbertodt-1/+0
This is done in order to deprecate AsciiExt eventually.
2017-09-28Fix errors in Box<Path> conversionsNikolai Vazquez-2/+4
2017-09-28Remove unused 'mem' import in 'path' moduleNikolai Vazquez-1/+0
2017-09-28Remove mem::transmute used in Path conversionsNikolai Vazquez-8/+9
2017-08-23Rollup merge of #43983 - ids1024:redox-path-prefix, r=alexcrichtonCorey Farwell-3/+13
Redox: correct is_absolute() and has_root() This is awkward, but representing schemes properly in `Components` is not easily possible without breaking backwards compatibility, as discussed earlier in https://github.com/rust-lang/rust/pull/37702. But these methods can be corrected anyway.
2017-08-23Auto merge of #43830 - alexcrichton:path-display-regression, r=aturonbors-0/+6
std: Respect formatting flags for str-like OsStr Historically many `Display` and `Debug` implementations for `OsStr`-like abstractions have gone through `String::from_utf8_lossy`, but this was updated in #42613 to use an internal `Utf8Lossy` abstraction instead. This had the unfortunate side effect of causing a regression (#43765) in code which relied on these `fmt` trait implementations respecting the various formatting flags specified. This commit opportunistically adds back interpretation of formatting trait flags in the "common case" where where `OsStr`-like "thing" is all valid utf-8 and can delegate to the formatting implementation for `str`. This doesn't entirely solve the regression as non-utf8 paths will format differently than they did before still (in that they will not respect formatting flags), but this should solve the regression for all "real world" use cases of paths and such. The door's also still open for handling these flags in the future! Closes #43765
2017-08-22Simplify code for handling Redox pathsIan Douglas Scott-10/+5
2017-08-22Use cfg! instead of #[cfg]Ian Douglas Scott-13/+3
2017-08-18Correct has_root() on RedoxIan Douglas Scott-3/+20
2017-08-18redox: Require scheme for path to be absoluteIan Douglas Scott-2/+10
Redox paths are problematic. It would make sense to add a `Scheme` variant to the `std::path::Component` enum; but that would presumably be a breaking change due to exhaustive matching. Alternately it could use the existing `Prefix` variant, like Windows, but none of the existing types of prefix make sense, Redox only has one kind, and adding a new variant to that enum has the same issue as `Component`.
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-1/+1
Like #43008 (f668999), but _much more aggressive_.
2017-08-13std: Respect formatting flags for str-like OsStrAlex Crichton-0/+6
Historically many `Display` and `Debug` implementations for `OsStr`-like abstractions have gone through `String::from_utf8_lossy`, but this was updated in #42613 to use an internal `Utf8Lossy` abstraction instead. This had the unfortunate side effect of causing a regression (#43765) in code which relied on these `fmt` trait implementations respecting the various formatting flags specified. This commit opportunistically adds back interpretation of formatting trait flags in the "common case" where where `OsStr`-like "thing" is all valid utf-8 and can delegate to the formatting implementation for `str`. This doesn't entirely solve the regression as non-utf8 paths will format differently than they did before still (in that they will not respect formatting flags), but this should solve the regression for all "real world" use cases of paths and such. The door's also still open for handling these flags in the future! Closes #43765
2017-08-02Emphasise that these functions look at the disk, not just the pathKornel-2/+2
2017-07-25std: Stabilize CString/OsString/PathBuf extra methodsAlex Crichton-2/+2
Stabilizes: * `CString::as_c_str` * `CString::into_boxed_c_str` * `CStr::into_c_string` * `OsString::into_boxed_os_str` * `OsStr::into_os_string` * `PathBuf::into_boxed_path` * `PathBuf::into_path_buf` Closes #40380
2017-07-23Fix some doc/comment typos.Bruce Mitchener-3/+3
2017-07-14Rollup merge of #43229 - kennytm:return-false-if-path-is-relative-hahaha, ↵Corey Farwell-10/+10
r=steveklabnik Fix minor typo in std::path documentation. Fix minor typo in `std::path` documentation. Replace all `'C' as u8` with `b'C'`.
2017-07-14Fix minor typo in std::path documentation.kennytm-10/+10
Replace all `'C' as u8` with `b'C'`.
2017-07-13Rollup merge of #42926 - Havvy:doc-path-ext, r=steveklabnikSteve Klabnik-0/+34
Document what happens on failure in path ext is_file is_dir r? @steveklabnik Also, what other ways could there be an error that gets discarded and returns false? Should we list them all? Should we say that any errors trying to access the metadata at that path causes it to return false, even if there might be a file or directory there? Should I add a See also link to the original functions that do return Results?
2017-07-12Document error coercion to false in path-ext methods + see also sectionsHavvy-0/+34
2017-07-04Rollup merge of #42227 - ollie27:into_to_from, r=aturonMark Simulacrum-4/+4
Convert Intos to Froms. This is a resubmission of #42129 without `impl<T> From<Vec<T>> for Box<[T]>`.
2017-06-28Document that `/` works as separator on WindowsAleksey Kladov-6/+7
2017-06-21Update version numbers for From implsOliver Middleton-1/+1
2017-06-21Convert Intos to Froms.Clar Charr-3/+3
2017-06-15Avoid allocations in Debug for os_strStepan Koltsov-4/+4
Fixes #38879
2017-05-20Remove unused lifetimes.Clar Charr-1/+1
2017-05-20Correct some stability versionsOliver Middleton-3/+3
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-09Add more ways to create a PathBuf to docssteveklabnik-1/+35
The best way to do this wasn't in the documentation, and the ways that were there needed some extra text to elaborate. Fixes #40159
2017-04-22Fix invalid linkageGuillaume Gomez-1/+1
2017-04-20Expanded docs and examples for PathBuf::file_name and friendsMatt Brubeck-2/+15
2017-04-20Rollup merge of #41390 - scottmcm:toowned-clone-into, r=alexcrichtonCorey Farwell-0/+12
Override ToOwned::clone_into for Path and OsStr The only non-overridden one remaining is the CStr impl, which cannot be optimized as doing so would break CString's second invariant. Follow-up to 7ec27ae (PR #41009). r? @alexcrichton
2017-04-18Override ToOwned::clone_into for Path and OsStrScott McMurray-0/+12
The only non-overridden one remaining is the CStr impl, which cannot be optimized as doing so would break CString's second invariant.
2017-04-18Fix typos in std::path's docslukaramu-4/+4
* Closed an unclosed paren * seperator -> separator * deperator -> separator
2017-04-17Expand std::path::Display's docslukaramu-1/+20
Part of #29368. * Added explanation for why the struct exists * Added link to where it is created * Added example
2017-04-17Restructure and redistribute std::path's module docslukaramu-64/+55
Part of #29368. * Added a new summary paragraph about std::path's parsing facilities * Slightly exanded `Component`'s docs * removed the now redundant section on component types from the module docs * moved the section on path normalization during parsing to the docs on `Path::components` * Clarified difference between `Prefix` and `PrefixComponent` in their respecive summary sentences
2017-04-17Expand and add examples to std::path::{Prefix, PrefixComponent}'s docslukaramu-10/+106
Part of #29368.
2017-04-15Cleaned up throughout std::path's docslukaramu-47/+78
Part of #29368. * added missing links * updated method summaries to use 3rd person style * added missing periods in `Component`'s variant summaries * use standard iterator boilerplate in `Components`' and `Iter`'s docs * added example to `Iter::as_path`, adapted from `Components::as_path`'s example * consolidated examples for `Path::file_name` * some other small fixes
2017-03-19Fix a typo in path.rs docsPetr Zemek-1/+1
The name of the variable used in the example is `path`, not `os_str`.
2017-03-17Auto merge of #40598 - frewsxcv:rollup, r=frewsxcvbors-16/+16
Rollup of 23 pull requests - Successful merges: #40387, #40433, #40452, #40456, #40457, #40458, #40463, #40466, #40467, #40495, #40496, #40497, #40499, #40500, #40503, #40505, #40512, #40514, #40517, #40520, #40536, #40545, #40586 - Failed merges:
2017-03-17Rollup merge of #40456 - frewsxcv:frewsxcv-docs-function-parens, ↵Corey Farwell-16/+16
r=GuillaumeGomez Remove function invokation parens from documentation links. This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-15Removes Default for Box<Path>.Clar Charr-14/+0
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-16/+16
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-10Add From<Box<..>> implementations.Clar Charr-7/+27
2017-02-14Conversions between CStr/OsStr/Path and boxes.Clar Charr-0/+40
2017-02-07Rollup merge of #38764 - Aaronepower:master, r=aturonCorey Farwell-0/+7
Added Default impl to PathBuf
2017-01-14Auto merge of #38935 - redox-os:fix_path_redox, r=brsonbors-1/+2
Fix is_absolute on Redox Due to not using prefixes on Redox, yet, it must be added as an exception to Path::is_absolute.
2017-01-13Fix is_absolute on RedoxJeremy Soller-1/+2
2017-01-13Rollup merge of #38946 - GuillaumeGomez:path_doc, r=frewsxcvGuillaume Gomez-22/+95
Add missing links and examples for path modules and structs r? @frewsxcv
2017-01-11Add missing links and examples for path modules and structsGuillaume Gomez-22/+95