diff options
| author | bors <bors@rust-lang.org> | 2013-08-30 16:10:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-08-30 16:10:52 -0700 |
| commit | 8002a09bf915bd186e4e455b25265b4160bfd125 (patch) | |
| tree | 2461569ffefc605dd49525d76f50fc8ed6c98b6e /src/libstd | |
| parent | 6a225951e3c35cb634ab4ab700d043689fbabd70 (diff) | |
| parent | 98e470ad731c66c4c16f2a31d498c316d30dadd5 (diff) | |
| download | rust-8002a09bf915bd186e4e455b25265b4160bfd125.tar.gz rust-8002a09bf915bd186e4e455b25265b4160bfd125.zip | |
auto merge of #8831 : catamorphism/rust/extend_rust_path, r=catamorphism
r? @brson @metajack requested the ability to violate the "only workspaces can be in the RUST_PATH" rule for the purpose of bootstrapping Servo without having to restructure all the directories. This patch gives rustpkg the ability to find sources if a directory in the RUST_PATH directly contains one of rustpkg's "special" files (lib.rs, main.rs, bench.rs, or test.rs), even if it's not a workspace. In this case, it puts the build artifacts in the first workspace in the RUST_PATH. I'm not sure whether or not it's a good idea to keep this feature in rustpkg permanently. Thus, I added a flag, ```--use-rust-path-hack```, and only enabled it when the flag is set.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/os.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 07e0b0857a1..91408162788 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -1002,6 +1002,18 @@ pub fn remove_file(p: &Path) -> bool { } } +/// Renames an existing file or directory +pub fn rename_file(old: &Path, new: &Path) -> bool { + #[fixed_stack_segment]; #[inline(never)]; + unsafe { + do old.with_c_str |old_buf| { + do new.with_c_str |new_buf| { + libc::rename(old_buf, new_buf) == (0 as c_int) + } + } + } +} + #[cfg(unix)] /// Returns the platform-specific value of errno pub fn errno() -> int { |
