about summary refs log tree commit diff
path: root/src/libstd/fs.rs
AgeCommit message (Collapse)AuthorLines
2015-04-21rollup merge of #24222: lambda/rename-soft-link-to-symlinkAlex Crichton-7/+14
Implement [RFC #1048][rfc]. On Windows, when you create a symbolic link you must specify whether it points to a directory or a file, even if it is created dangling, while on Unix, the same symbolic link could point to a directory, a file, or nothing at all. Furthermore, on Windows special privilege is necessary to use a symbolic link, while on Unix, you can generally create a symbolic link in any directory you have write privileges to. This means that it is unlikely to be able to use symbolic links purely portably; anyone who uses them will need to think about the cross platform implications. This means that using platform-specific APIs will make it easier to see where code will need to differ between the platforms, rather than trying to provide some kind of compatibility wrapper. Furthermore, `soft_link` has no precedence in any other API, so to avoid confusion, move back to the more standard `symlink` terminology. Create a `std::os::unix::symlink` for the Unix version that is destination type agnostic, as well as `std::os::windows::{symlink_file, symlink_dir}` for Windows. Because this is a stable API, leave a compatibility wrapper in `std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file` on Windows, preserving the existing behavior of `soft_link`. [rfc]: https://github.com/rust-lang/rfcs/pull/1048
2015-04-21Deprecate std::fs::soft_link in favor of platform-specific versionsBrian Campbell-7/+14
On Windows, when you create a symbolic link you must specify whether it points to a directory or a file, even if it is created dangling, while on Unix, the same symbolic link could point to a directory, a file, or nothing at all. Furthermore, on Windows special privilege is necessary to use a symbolic link, while on Unix, you can generally create a symbolic link in any directory you have write privileges to. This means that it is unlikely to be able to use symbolic links purely portably; anyone who uses them will need to think about the cross platform implications. This means that using platform-specific APIs will make it easier to see where code will need to differ between the platforms, rather than trying to provide some kind of compatibility wrapper. Furthermore, `soft_link` has no precedence in any other API, so to avoid confusion, move back to the more standard `symlink` terminology. Create a `std::os::unix::symlink` for the Unix version that is destination type agnostic, as well as `std::os::windows::{symlink_file, symlink_dir}` for Windows. Because this is a stable API, leave a compatibility wrapper in `std::fs::soft_link`, which calls `symlink` on Unix and `symlink_file` on Windows, preserving the existing behavior of `soft_link`.
2015-04-21Implement Debug for FileChris Wong-0/+7
This patch adds a `Debug` impl for `std::fs::File`. On all platforms (Unix and Windows) it shows the file descriptor. On Linux, it displays the path and access mode as well. Ideally we should show the path/mode for all platforms, not just Linux, but this will do for now. cc #24570
2015-04-17Rollup merge of #24452 - tbu-:pr_file_path, r=aturonManish Goregaokar-7/+6
Fixes #22190.
2015-04-15Fix some typos.Ms2ger-2/+2
2015-04-15Remove one allocation for the file path in file openingTobias Bucher-7/+6
Fixes #22190.
2015-04-14rollup merge of #24377: apasel422/docsAlex Crichton-13/+13
Conflicts: src/libstd/net/ip.rs src/libstd/sys/unix/fs.rs src/libstd/sys/unix/mod.rs src/libstd/sys/windows/mod.rs
2015-04-14test: Fixup many library unit testsAlex Crichton-2/+3
2015-04-13pluralize doc comment verbs and add missing periodsAndrew Paseltiner-13/+13
2015-04-07std: Deny most warnings in doctestsAlex Crichton-11/+14
Allow a few specific ones but otherwise this helps ensure that our examples are squeaky clean! Closes #18199
2015-04-02Auto merge of #23931 - steveklabnik:doc_std_fs, r=alexcrichtonbors-42/+306
2015-04-02Add more examples and documentation for std::fsSteve Klabnik-42/+306
2015-04-02Test fixes and rebase conflicts, round 2Alex Crichton-1/+1
Conflicts: src/libcore/num/mod.rs
2015-03-31rollup merge of #23919: alexcrichton/stabilize-io-errorAlex Crichton-2/+1
Conflicts: src/libstd/fs/tempdir.rs src/libstd/io/error.rs
2015-03-31rollup merge of #23873: alexcrichton/remove-deprecatedAlex Crichton-0/+1647
Conflicts: src/libcollectionstest/fmt.rs src/libcollectionstest/lib.rs src/libcollectionstest/str.rs src/libcore/error.rs src/libstd/fs.rs src/libstd/io/cursor.rs src/libstd/os.rs src/libstd/process.rs src/libtest/lib.rs src/test/run-pass-fulldeps/compiler-calls.rs
2015-03-31std: Clean out #[deprecated] APIsAlex Crichton-0/+1641
This commit cleans out a large amount of deprecated APIs from the standard library and some of the facade crates as well, updating all users in the compiler and in tests as it goes along.
2015-02-24std: Move std::env to the new I/O APIsAlex Crichton-1503/+0
This commit moves `std::env` away from the `std::old_io` error type as well as the `std::old_path` module. Methods returning an error now return `io::Error` and methods consuming or returning paths use `std::path` instead of `std::old_path`. This commit does not yet mark these APIs as `#[stable]`. This commit also migrates `std::old_io::TempDir` to `std::fs::TempDir` with essentially the exact same API. This type was added to interoperate with the new path API and has its own `tempdir` feature. Finally, this commit reverts the deprecation of `std::os` APIs returning the old path API types. This deprecation can come back once the entire `std::old_path` module is deprecated. [breaking-change]
2015-02-20try to reduce bajillion warningsAlexis-2/+4
2015-02-17Fix a small typo in libstd/fs.rsMarkus Siemens-1/+1
2015-02-15doc: fix and expand File::create explanationTshepang Lekhonkhobe-3/+3
2015-02-09std: Add a new `fs` moduleAlex Crichton-0/+1501
This commit is an implementation of [RFC 739][rfc] which adds a new `std::fs` module to the standard library. This module provides much of the same functionality as `std::old_io::fs` but it has many tweaked APIs as well as uses the new `std::path` module. [rfc]: https://github.com/rust-lang/rfcs/pull/739
2012-03-12Libc/os/run/rand/io reorganization. Close #1373. Close #1638.Graydon Hoare-765/+0
- Move io, run and rand to core. - Remove incorrect ctypes module (use libc). - Remove os-specific modules for os and fs. - Split fs between core::path and core::os.
2012-03-08Rename last to last_opt, last_unsafe to lastTim Chevalier-1/+1
As per discussion on IRC. I am about to file an RFC for further discussion about the more general issue of whether to enforce invariants through types, typestate, or dynamic checks, but for now, removing the misleading name "last_unsafe".
2012-03-08Rename last_total to last_unsafeTim Chevalier-1/+2
See Issue 1943 for any discussion (reopen it if necessary). Closes #1943
2012-03-02std: add a fs::remove_file function.Erick Tryzelaar-0/+21
2012-02-29std: DeCamelCase fs::splitDirnameBasenameBrian Anderson-3/+3
2012-02-23Finish cleanup of core::strMarijn Haverbeke-12/+8
Closes #1849
2012-02-23Various cleanups and optimizations in core::strMarijn Haverbeke-13/+5
2012-02-23(core::str) remove len_bytes aliasKevin Cantu-6/+6
2012-02-23(core::str) do some replacementsKevin Cantu-4/+4
2012-02-23(core::char) rename slice -> slice_charsKevin Cantu-2/+2
2012-02-23(core::str) rename rindex -> rindex_charsKevin Cantu-2/+2
2012-02-23(core::str) mostly rename len -> len_charsKevin Cantu-1/+1
2012-02-22Remove preconditions from librariesMarijn Haverbeke-2/+1
Closes #1805
2012-02-12(core::str) rename byte_len -> len_bytes and rename char_len -> lenKevin Cantu-6/+6
2012-02-12(core::str) move push_byte, push_bytes, pop_byte, and shift_byte into ↵Kevin Cantu-3/+3
str::unsafe
2012-02-11using str::rindex...Kevin Cantu-17/+20
2012-02-11core::str rename [r]index -> [r]index_bytesKevin Cantu-4/+4
2012-02-09Increase precedence of as operatorMarijn Haverbeke-2/+2
Closes #1717
2012-02-07core: make str::substr use char positions (and replace other uses)Kevin Cantu-2/+2
2012-02-07String split renaming:Kevin Cantu-4/+9
* Renamed str::split -> str::split_byte * Renamed str::splitn -> str::splitn_byte * Renamed str::split_func -> str::split * Renamed str::split_char -> str::split_char * Renamed str::split_chars_iter -> str::split_char_iter * Added u8::is_ascii * Fixed the behavior of str::split_str, so that it matches split_chars and split (i.e. ["", "XXX", "YYY", ""] == split_str(".XXX.YYY.", ".")) * Fixed str::split_byte and str::splitn_byte so that they handle splitting UTF-8 strings on a given UTF-8/ASCII byte and also handle "" as the others do
2012-02-05std: Use ctypes::c_int in path_is_dirBrian Anderson-4/+1
2012-02-01Rename (again) str::unsafe::slice -> str::unsafe::slice_bytes andKevin Cantu-1/+1
str::unsafe::safe_slice -> str::unsafe::slice_bytes_safe_range
2012-02-01Propagating unsafe::slice 2Kevin Cantu-2/+2
2012-01-18Remove '.' after nullary tags in patternsTim Chevalier-1/+1
Does what it says on the tin. The next commit will remove support for this syntax.
2012-01-19libstd: Revert an integer type castingHaitao Li-1/+4
Otherwise, rustctest failed by a segv fault.
2012-01-19rustc: Use integer from ctypes consistentlyHaitao Li-2/+6
2012-01-19Use ctypes in native function declarationsHaitao Li-4/+4
2012-01-17libstd: Move std tests into libstdBrian Anderson-0/+285
2012-01-09Fix rpath bug.Graydon Hoare-9/+12