Skip to content

Commit c15251a

Browse files
committed
---
yaml --- r: 152285 b: refs/heads/try2 c: f377dfe h: refs/heads/master i: 152283: 8b98046 v: v3
1 parent 87243c1 commit c15251a

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 650909244eee51b4fd70389538c6b784ccf005c7
8+
refs/heads/try2: f377dfe5acfd7023d535a94cfe9466276affc6da
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/os.rs

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,24 @@ pub fn close(fd: int) -> int {
6666
pub static TMPBUF_SZ : uint = 1000u;
6767
static BUF_BYTES : uint = 2048u;
6868

69-
/// Returns the current working directory.
69+
/// Returns the current working directory as a Path.
70+
///
71+
/// # Failure
72+
///
73+
/// Fails if the current working directory value is invalid:
74+
/// Possibles cases:
75+
///
76+
/// * Current directory does not exist.
77+
/// * There are insufficient permissions to access the current directory.
78+
///
79+
/// # Example
80+
///
81+
/// ```rust
82+
/// // We assume that we are in a valid directory like "/home".
83+
/// let current_working_directory = std::os::getcwd();
84+
/// println!("The current directory is {}", current_working_directory.display());
85+
/// // /home
86+
/// ```
7087
#[cfg(unix)]
7188
pub fn getcwd() -> Path {
7289
use c_str::CString;
@@ -80,7 +97,24 @@ pub fn getcwd() -> Path {
8097
}
8198
}
8299

83-
/// Returns the current working directory.
100+
/// Returns the current working directory as a Path.
101+
///
102+
/// # Failure
103+
///
104+
/// Fails if the current working directory value is invalid.
105+
/// Possibles cases:
106+
///
107+
/// * Current directory does not exist.
108+
/// * There are insufficient permissions to access the current directory.
109+
///
110+
/// # Example
111+
///
112+
/// ```rust
113+
/// // We assume that we are in a valid directory like "C:\\Windows".
114+
/// let current_working_directory = std::os::getcwd();
115+
/// println!("The current directory is {}", current_working_directory.display());
116+
/// // C:\\Windows
117+
/// ```
84118
#[cfg(windows)]
85119
pub fn getcwd() -> Path {
86120
use libc::DWORD;

0 commit comments

Comments
 (0)