about summary refs log tree commit diff
path: root/library/std/src/fs.rs
AgeCommit message (Collapse)AuthorLines
2023-10-31Stabilize `file_set_times`Josh Triplett-9/+7
Approved via FCP in https://github.com/rust-lang/rust/issues/98245 .
2023-10-05Add more diagnostic items for clippyJason Newcomb-0/+3
2023-09-19Auto merge of #104101 - betrusted-io:xous-libstd-initial, r=bjorn3bors-1/+1
Add initial libstd support for Xous This patchset adds some minimal support to the tier-3 target `riscv32imac-unknown-xous-elf`. The following features are supported: * alloc * thread creation and joining * thread sleeping * thread_local * panic_abort * mutex * condvar * stdout Additionally, internal support for the various Xous primitives surrounding IPC have been added as part of the Xous FFI. These may be exposed as part of `std::os::xous::ffi` in the future, however for now they are not public. This represents the minimum viable product. A future patchset will add support for networking and filesystem support.
2023-09-01Auto merge of #114448 - SteveLauC:std_fs_read_doc, r=Mark-Simulacrumbors-5/+7
docs: improve std::fs::read doc #### What does this PR do 1. Rephrase a confusing sentence in the document of `std::fs::read()` ----- Closes #114432 cc `@Dexus0` `@saethlin`
2023-09-01docs: improve std::fs::read docSteve Lau-5/+7
2023-08-25Add a new helper to avoid calling io::Error::kindBen Kimock-0/+3
2023-08-22std: fs: skip fs tests on xousSean Cross-1/+1
The xous filesystem support is not yet ready for merging. Signed-off-by: Sean Cross <sean@xobs.io>
2023-08-22Replace version placeholders with 1.73.0Mark Rousskov-3/+3
2023-07-28inline trivial (noop) flush callsThom Chiovoloni-0/+3
2023-07-10Auto merge of #94748 - tbu-:pr_file_arc, r=Amanieubors-32/+65
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC #53835. CC #94744.
2023-06-23Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriateTobias Bucher-0/+46
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC #53835. CC #94744.
2023-06-23Forward `io::{Read,Seek,Write}` impls of `File` to `&File`Tobias Bucher-33/+20
This reduces code duplication.
2023-06-23DirEntry::file_name: improve explanationTshepang Mbambo-2/+8
2023-05-19Auto merge of #109773 - beetrees:set-file-time-improvements, r=Amanieubors-0/+11
Add creation time support to `FileTimes` on apple and windows Adds support for setting file creation times on platforms which support changing it directly (currently only Apple and Windows). Based on top of #110093 (which was split from this PR). ACP: rust-lang/libs-team#199 (currently still in progress) Tracking issue: #98245 `@rustbot` label +T-libs-api -T-libs
2023-05-15Add creation time support to `FileTimes` on apple and windowsbeetrees-0/+11
2023-05-15wanting => wantVagelis Prokopiou-1/+1
2023-05-01Inline AsInner implementationsKonrad Borowski-0/+8
2023-04-27docs(std): clarify `remove_dir_all` errorsPhilpax-0/+5
2023-04-26Rollup merge of #110266 - tgross35:try-exists-wording, r=jyn514jyn-3/+4
Update documentation wording on path 'try_exists' functions Just eliminate the quadruple negation in `doesn't silently ignore errors unrelated to ... not existing.`
2023-04-21Limit read size in `File::read_to_end` loopChris Denton-18/+22
This works around performance issues on Windows by limiting reads the size of reads when the expected size is known.
2023-04-13Update documentation wording on path 'try_exists' functionsTrevor Gross-3/+4
2023-02-15Suggest simpler fs helper methods in File::{open,create}Kornel-1/+10
2023-02-15Demonstrate I/O in File examplesKornel-0/+9
2023-01-14Fix some missed double spaces.André Vennberg-1/+1
2023-01-11use with_capacity in read read_to_stringyukang-4/+2
2023-01-08Remove unnecessary lseek syscall when using std::fs::readyukang-2/+6
2022-12-03Rollup merge of #105100 - jhpratt:fix-docs, r=JohnTitorYuki Okushi-2/+3
Add missing intra-doc link Trivial change. This makes the plain text into inline code and makes it a link. `@rustbot` label +A-docs
2022-12-01Add tracking issue for file_create_newAndrius Pukšta-1/+1
2022-11-30Add missing intra-doc linkJacob Pratt-2/+3
2022-09-19Document surprising and dangerous fs::Permissions behaviour on UnixTim Hutt-3/+64
This documents the very surprising behaviour that `set_readonly(false)` will make a file *world writable* on Unix. I would go so far as to say that this function should be deprecated on Unix, or maybe even entirely. But documenting the bad behaviour is a good first step.
2022-09-03updated description of File struct in std::fsBart Massey-1/+1
2022-08-29Rollup merge of #98801 - joshtriplett:file-create-new, r=thomccDylan DPC-0/+29
Add a `File::create_new` constructor We have `File::create` for creating a file or opening an existing file, but the secure way to guarantee creating a new file requires a longhand invocation via `OpenOptions`. Add `File::create_new` to handle this case, to make it easier for people to do secure file creation.
2022-08-18Address reviewer commentsNick Cameron-2/+2
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-05non-linux platformsNick Cameron-3/+3
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-04std::io: migrate ReadBuf to BorrowBuf/BorrowCursorNick Cameron-5/+5
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-08-01Auto merge of #98246 - joshtriplett:times, r=m-ou-sebors-0/+81
Support setting file accessed/modified timestamps Add `struct FileTimes` to contain the relevant file timestamps, since most platforms require setting all of them at once. (This also allows for future platform-specific extensions such as setting creation time.) Add `File::set_file_time` to set the timestamps for a `File`. Implement the `sys` backends for UNIX, macOS (which needs to fall back to `futimes` before macOS 10.13 because it lacks `futimens`), Windows, and WASI.
2022-07-15Add alias `File::set_modified` as shorthandJosh Triplett-0/+9
2022-07-15Support setting file accessed/modified timestampsJosh Triplett-0/+72
Add `struct FileTimes` to contain the relevant file timestamps, since most platforms require setting all of them at once. (This also allows for future platform-specific extensions such as setting creation time.) Add `File::set_file_time` to set the timestamps for a `File`. Implement the `sys` backends for UNIX, macOS (which needs to fall back to `futimes` before macOS 10.13 because it lacks `futimens`), Windows, and WASI.
2022-07-12Add a `File::create_new` constructorJosh Triplett-0/+29
We have `File::create` for creating a file or opening an existing file, but the secure way to guarantee creating a new file requires a longhand invocation via `OpenOptions`. Add `File::create_new` to handle this case, to make it easier for people to do secure file creation.
2022-07-11Add std::fs::write documentation precisionLucas Dumont-0/+6
As mentioned in #97947, the documentation is updated
2022-06-14Stabilize `Path::try_exists()` and improve docMartin Habovstiak-2/+6
This stabilizes the `Path::try_exists()` method which returns `Result<bool, io::Error>` instead of `bool` allowing handling of errors unrelated to the file not existing. (e.g permission errors) Along with the stabilization it also: * Warns that the `exists()` method is error-prone and suggests to use the newly stabilized one. * Suggests it instead of `metadata()` to handle errors. * Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is completely safe fixed version of `exists()`. * Renames the feature of still-unstable `std::fs::try_exists()` to `fs_try_exists` to avoid name conflict. The tracking issue #83186 remains open to track `fs_try_exists`.
2022-06-01Fix Windows file metadata docsReilly Wood-2/+2
Retrieving file metadata on Windows now uses GetFileInformationByHandle not GetFileAttributesEx
2022-05-09Auto merge of #95960 - jhpratt:remove-rustc_deprecated, r=compiler-errorsbors-3/+3
Remove `#[rustc_deprecated]` This removes `#[rustc_deprecated]` and introduces diagnostics to help users to the right direction (that being `#[deprecated]`). All uses of `#[rustc_deprecated]` have been converted. CI is expected to fail initially; this requires #95958, which includes converting `stdarch`. I plan on following up in a short while (maybe a bootstrap cycle?) removing the diagnostics, as they're only intended to be short-term.
2022-04-30add aliases for std::fs::canonicalizejulio-0/+2
2022-04-14Remove use of `#[rustc_deprecated]`Jacob Pratt-3/+3
2022-04-11Document that DirEntry holds the directory openMartin Pool-0/+10
2022-04-05Document synchronicityChris Denton-0/+6
2022-03-29Warn that platform-specific behavior may changeMartin Pool-1/+1
2022-03-24Document Linux kernel handoff in std::io::copy and std::fs::copyMartin Pool-2/+8
2022-03-20Rollup merge of #94749 - RalfJung:remove-dir-all-miri, r=cuviperMatthias Krüger-3/+4
remove_dir_all: use fallback implementation on Miri Fixes https://github.com/rust-lang/miri/issues/1966 The new implementation requires `openat`, `unlinkat`, and `fdopendir`. These cannot easily be shimmed in Miri since libstd does not expose APIs corresponding to them. So for now it is probably easiest to just use the fallback code in Miri. Nobody should run Miri as root anyway...