about summary refs log tree commit diff
path: root/src/libstd/fs.rs
AgeCommit message (Collapse)AuthorLines
2016-11-28Remove file path from std::fs::FileJeremy Soller-10/+0
2016-11-23Merge branch 'master' into redoxJeremy Soller-1/+54
2016-11-22Add a method for setting permissions directly on an open file.Steven Allen-0/+53
On unix like systems, the underlying file corresponding to any given path may change at any time. This function makes it possible to set the permissions of the a file corresponding to a `File` object even if its path changes.
2016-11-10Use target_os = redox for cfgJeremy Soller-1/+1
2016-10-28Remove unsafe libc layerJeremy Soller-0/+10
2016-10-16impl Debug for ReadDirDavid Henningsson-0/+1
It is good practice to implement Debug for public types, and indicating what directory you're reading seems useful. Signed-off-by: David Henningsson <diwic@ubuntu.com>
2016-10-09Implement reading and writing atomically at certain offsetsTobias Bucher-1/+125
These functions allow to read from and write to a file in one atomic action from multiple threads, avoiding the race between the seek and the read. The functions are named `{read,write}_at` on non-Windows (which don't change the file cursor), and `seek_{read,write}` on Windows (which change the file cursor).
2016-09-30Ignore various entire test modules on emscriptenBrian Anderson-50/+1
2016-09-30Ignore lots and lots of std tests on emscriptenBrian Anderson-0/+49
2016-09-22Implement Debug for DirEntry.Corey Farwell-0/+20
2016-08-31Rollup merge of #35786 - GuillaumeGomez:paths_doc, r=steveklabnikJonathan Turner-2/+5
Improve Path and PathBuf docs r? @steveklabnik
2016-08-31Improve Path and PathBuf docsGuillaume Gomez-2/+5
2016-08-24Use `#[prelude_import]` in `libstd`.Jeffrey Seyfried-2/+0
2016-08-05Rollup merge of #35076 - GuillaumeGomez:file_type_docs, r=steveklabnikGuillaume Gomez-1/+59
Add doc examples for FileType struct Part of #29356. r? @steveklabnik
2016-08-03Add doc examples for FileType structGuillaume Gomez-1/+59
2016-07-28Add doc examples for std::fs::MetadataGuillaume Gomez-0/+51
2016-07-26Rollup merge of #35010 - GuillaumeGomez:file_doc, r=steveklabnikSteve Klabnik-5/+23
Improve Open doc Part of #29356. r? @steveklabnik
2016-07-26Rollup merge of #35009 - GuillaumeGomez:dir_entry_doc, r=steveklabnikSteve Klabnik-12/+84
Dir entry doc Part of #29356. r? @steveklabnik
2016-07-24Improve Open docGuillaume Gomez-5/+23
2016-07-24Add DirEntry doc examplesGuillaume Gomez-0/+55
2016-07-24Add missing linksGuillaume Gomez-12/+29
2016-07-23Add DirBuilder doc examplesGuillaume Gomez-1/+18
2016-07-18Remove rustdoc reference to `walk_dir`Mark Buer-2/+2
2016-07-10Derive Debug on FileType.Martin Pool-1/+1
Partially fixes #32054
2016-06-15Fix a docs typoGleb Kozyrev-1/+1
2016-06-15Test ErrorKind::AlreadyExists for filesGleb Kozyrev-0/+9
2016-06-02Rollup merge of #34019 - kennytm:fix-33958, r=steveklabnikGuillaume Gomez-2/+3
Restore original meaning of std::fs::read_dir's example changed in #33958 `DirEntry.file_type().is_dir()` will not follow symlinks, but the original example (`fs::metadata(&path).is_dir()`) does. Therefore the change in #33958 introduced a subtle difference that now it won't enter linked folders. To preserve the same behavior, we use `Path::is_dir()` instead, which does follow symlink. (See discussion in the previous PR for detail.)
2016-06-02Restore original meaning of std::fs::read_dir's example changed in #33958.kennytm-2/+3
DirEntry.file_type().is_dir() will not follow symlinks, but the original example (fs::metadata(&path).is_dir()) does. Therefore the change in #33958 introduced a subtle difference that now it won't enter linked folders. To preserve the same behavior, we use Path::is_dir() instead, which does follow symlink.
2016-06-01allow for the future addition of a close method on FileJack O'Connor-2/+1
2016-05-31document that Files close themselves automaticallyJack O'Connor-0/+3
2016-05-30Use Path::is_dir() in fs::read_dir()'s example.kennytm-2/+2
Basically reverts #25508. The `is_dir()` function has been stable since 1.5.0.
2016-05-24std: Stabilize APIs for the 1.10 releaseAlex Crichton-3/+3
This commit applies the FCP decisions made by the libs team for the 1.10 cycle, including both new stabilizations and deprecations. Specifically, the list of APIs is: Stabilized: * `os::windows::fs::OpenOptionsExt::access_mode` * `os::windows::fs::OpenOptionsExt::share_mode` * `os::windows::fs::OpenOptionsExt::custom_flags` * `os::windows::fs::OpenOptionsExt::attributes` * `os::windows::fs::OpenOptionsExt::security_qos_flags` * `os::unix::fs::OpenOptionsExt::custom_flags` * `sync::Weak::new` * `Default for sync::Weak` * `panic::set_hook` * `panic::take_hook` * `panic::PanicInfo` * `panic::PanicInfo::payload` * `panic::PanicInfo::location` * `panic::Location` * `panic::Location::file` * `panic::Location::line` * `ffi::CStr::from_bytes_with_nul` * `ffi::CStr::from_bytes_with_nul_unchecked` * `ffi::FromBytesWithNulError` * `fs::Metadata::modified` * `fs::Metadata::accessed` * `fs::Metadata::created` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange` * `sync::atomic::Atomic{Usize,Isize,Bool,Ptr}::compare_exchange_weak` * `collections::{btree,hash}_map::{Occupied,Vacant,}Entry::key` * `os::unix::net::{UnixStream, UnixListener, UnixDatagram, SocketAddr}` * `SocketAddr::is_unnamed` * `SocketAddr::as_pathname` * `UnixStream::connect` * `UnixStream::pair` * `UnixStream::try_clone` * `UnixStream::local_addr` * `UnixStream::peer_addr` * `UnixStream::set_read_timeout` * `UnixStream::set_write_timeout` * `UnixStream::read_timeout` * `UnixStream::write_Timeout` * `UnixStream::set_nonblocking` * `UnixStream::take_error` * `UnixStream::shutdown` * Read/Write/RawFd impls for `UnixStream` * `UnixListener::bind` * `UnixListener::accept` * `UnixListener::try_clone` * `UnixListener::local_addr` * `UnixListener::set_nonblocking` * `UnixListener::take_error` * `UnixListener::incoming` * RawFd impls for `UnixListener` * `UnixDatagram::bind` * `UnixDatagram::unbound` * `UnixDatagram::pair` * `UnixDatagram::connect` * `UnixDatagram::try_clone` * `UnixDatagram::local_addr` * `UnixDatagram::peer_addr` * `UnixDatagram::recv_from` * `UnixDatagram::recv` * `UnixDatagram::send_to` * `UnixDatagram::send` * `UnixDatagram::set_read_timeout` * `UnixDatagram::set_write_timeout` * `UnixDatagram::read_timeout` * `UnixDatagram::write_timeout` * `UnixDatagram::set_nonblocking` * `UnixDatagram::take_error` * `UnixDatagram::shutdown` * RawFd impls for `UnixDatagram` * `{BTree,Hash}Map::values_mut` * `<[_]>::binary_search_by_key` Deprecated: * `StaticCondvar` - this, and all other static synchronization primitives below, are usable today through the lazy-static crate on stable Rust today. Additionally, we'd like the non-static versions to be directly usable in a static context one day, so they're unlikely to be the final forms of the APIs in any case. * `CONDVAR_INIT` * `StaticMutex` * `MUTEX_INIT` * `StaticRwLock` * `RWLOCK_INIT` * `iter::Peekable::is_empty` Closes #27717 Closes #27720 cc #27784 (but encode methods still exist) Closes #30014 Closes #30425 Closes #30449 Closes #31190 Closes #31399 Closes #31767 Closes #32111 Closes #32281 Closes #32312 Closes #32551 Closes #33018
2016-05-15Auto merge of #33251 - Kintaro:fix-typo-in-fs, r=GuillaumeGomezbors-2/+2
Fix a typo in error messages in std::fs tests Just a small correction to fix a typo in an error message in std::fs tests
2016-05-09Utilize `Result::unwrap_err` in more places.Corey Farwell-1/+1
2016-04-28Fix a typo in error messages in std::fs testsSimon Wollwage-2/+2
2016-04-12Auto merge of #31963 - barosl:rename-doc, r=alexcrichtonbors-1/+8
Describe more platform-specific behaviors of `std::fs::rename` I did some tests myself regarding the situation when both `from` and `to` exist, and the results were: On Linux: `from` | `to` | Result ---- | ---- | ---- Directory | Directory | Ok Directory | File | Error File | Directory | Error File | File | Ok On Windows: `from` | `to` | Result ---- | ---- | ---- Directory | Directory | Error Directory | File | Ok File | Directory | Error File | File | Ok This is a bit against the official MSDN documentation, which says "(`MOVEFILE_REPLACE_EXISTING`) cannot be used if `lpNewFileName` or `lpExistingFileName` names a directory." As evidenced above, `lpExistingFileName` *can* be a directory. I also mentioned the atomicity of the operation. Fixes #31301.
2016-04-12Describe more platform-specific behaviors of `std::fs::rename`Barosl Lee-1/+8
Fixes #31301.
2016-04-11std: Stabilize APIs for the 1.9 releaseAlex Crichton-5/+2
This commit applies all stabilizations, renamings, and deprecations that the library team has decided on for the upcoming 1.9 release. All tracking issues have gone through a cycle-long "final comment period" and the specific APIs stabilized/deprecated are: Stable * `std::panic` * `std::panic::catch_unwind` (renamed from `recover`) * `std::panic::resume_unwind` (renamed from `propagate`) * `std::panic::AssertUnwindSafe` (renamed from `AssertRecoverSafe`) * `std::panic::UnwindSafe` (renamed from `RecoverSafe`) * `str::is_char_boundary` * `<*const T>::as_ref` * `<*mut T>::as_ref` * `<*mut T>::as_mut` * `AsciiExt::make_ascii_uppercase` * `AsciiExt::make_ascii_lowercase` * `char::decode_utf16` * `char::DecodeUtf16` * `char::DecodeUtf16Error` * `char::DecodeUtf16Error::unpaired_surrogate` * `BTreeSet::take` * `BTreeSet::replace` * `BTreeSet::get` * `HashSet::take` * `HashSet::replace` * `HashSet::get` * `OsString::with_capacity` * `OsString::clear` * `OsString::capacity` * `OsString::reserve` * `OsString::reserve_exact` * `OsStr::is_empty` * `OsStr::len` * `std::os::unix::thread` * `RawPthread` * `JoinHandleExt` * `JoinHandleExt::as_pthread_t` * `JoinHandleExt::into_pthread_t` * `HashSet::hasher` * `HashMap::hasher` * `CommandExt::exec` * `File::try_clone` * `SocketAddr::set_ip` * `SocketAddr::set_port` * `SocketAddrV4::set_ip` * `SocketAddrV4::set_port` * `SocketAddrV6::set_ip` * `SocketAddrV6::set_port` * `SocketAddrV6::set_flowinfo` * `SocketAddrV6::set_scope_id` * `<[T]>::copy_from_slice` * `ptr::read_volatile` * `ptr::write_volatile` * The `#[deprecated]` attribute * `OpenOptions::create_new` Deprecated * `std::raw::Slice` - use raw parts of `slice` module instead * `std::raw::Repr` - use raw parts of `slice` module instead * `str::char_range_at` - use slicing plus `chars()` plus `len_utf8` * `str::char_range_at_reverse` - use slicing plus `chars().rev()` plus `len_utf8` * `str::char_at` - use slicing plus `chars()` * `str::char_at_reverse` - use slicing plus `chars().rev()` * `str::slice_shift_char` - use `chars()` plus `Chars::as_str` * `CommandExt::session_leader` - use `before_exec` instead. Closes #27719 cc #27751 (deprecating the `Slice` bits) Closes #27754 Closes #27780 Closes #27809 Closes #27811 Closes #27830 Closes #28050 Closes #29453 Closes #29791 Closes #29935 Closes #30014 Closes #30752 Closes #31262 cc #31398 (still need to deal with `before_exec`) Closes #31405 Closes #31572 Closes #31755 Closes #31756
2016-04-06avoid "==" in assert! when one of the values is a boolTshepang Lekhonkhobe-1/+1
2016-03-22try! -> ?Jorge Aparicio-3/+3
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-20Add unix socket support to the standard librarySteven Fackler-34/+3
2016-03-12std: Clean out deprecated APIsAlex Crichton-101/+1
Removes all unstable and deprecated APIs prior to the 1.8 release. All APIs that are deprecated in the 1.8 release are sticking around for the rest of this cycle. Some notable changes are: * The `dynamic_lib` module was moved into `rustc_back` as the compiler still relies on a few bits and pieces. * The `DebugTuple` formatter now special-cases an empty struct name with only one field to append a trailing comma.
2016-03-08std: Funnel read_to_end through to one locationAlex Crichton-2/+4
This pushes the implementation detail of proxying `read_to_end` through to `read_to_end_uninitialized` all the way down to the `FileDesc` and `Handle` implementations on Unix/Windows. This way intermediate layers will also be able to take advantage of this optimized implementation. This commit also adds the optimized implementation for `ChildStdout` and `ChildStderr`.
2016-03-04End stdlib module summaries with a full stop.Steve Klabnik-1/+1
Fixes #9447
2016-02-13Fixes #28528Paul Dicker-0/+20
Fix `read_link` to also be able to read the target of junctions on Windows. Also the path returned should not include a NT namespace, and there were some problems with permissions.
2016-02-09Minor spelling fixesCarlos E. Garcia-1/+1
2016-02-08Auto merge of #31468 - pitdicker:fs_tests_cleanup, r=alexcrichtonbors-0/+34
See #29412
2016-02-07Ignore if we can't create a symlink in this testPaul Dicker-1/+1
2016-02-07Don't let `remove_dir_all` recursively remove a symlinkPaul Dicker-0/+34
See #29412
2016-02-04std: Expose SystemTime accessors on fs::MetadataAlex Crichton-0/+67
These accessors are used to get at the last modification, last access, and creation time of the underlying file. Currently not all platforms provide the creation time, so that currently returns `Option`.