File tree Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Expand file tree Collapse file tree 4 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- refs/heads/master: 7c57b8baf5e71e114da226293f15cd96d5baacac
2
+ refs/heads/master: 8c6354ceb905895c9f305716c66d5c7a8e4d0225
Original file line number Diff line number Diff line change 1
1
2
2
import os:: getcwd;
3
+ import os_fs;
4
+ import str;
3
5
4
6
native "rust" mod rustrt {
5
7
fn rust_file_is_dir ( str path ) -> int ;
@@ -58,13 +60,12 @@ fn list_dir(path p) -> vec[str] {
58
60
ret full_paths;
59
61
}
60
62
61
- // FIXME: Windows absolute paths can start with \ for C:\ or
62
- // whatever... However, we're under MinGW32 so we have the same rules and
63
- // posix has.
64
63
fn path_is_absolute ( path p) -> bool {
65
- ret p . ( 0 ) == '/' ;
64
+ ret os_fs :: path_is_absolute ( p ) ;
66
65
}
67
66
67
+ // FIXME: under Windows, we should prepend the current drive letter to paths
68
+ // that start with a slash.
68
69
fn make_absolute ( path p) -> path {
69
70
if ( path_is_absolute ( p) ) {
70
71
ret p;
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ fn list_dir(str path) -> vec[str] {
32
32
33
33
}
34
34
35
+ fn path_is_absolute ( str p) -> bool {
36
+ ret str:: char_at ( p, 0 u) == '/' ;
37
+ }
38
+
35
39
const char path_sep = '/' ;
36
40
37
41
const char alt_path_sep = '/' ;
Original file line number Diff line number Diff line change @@ -7,6 +7,11 @@ native "rust" mod rustrt {
7
7
8
8
fn list_dir ( str path ) -> vec[ str ] { ret rustrt:: rust_list_files ( path + "*" ) ; }
9
9
10
+ fn path_is_absolute ( str p) -> bool {
11
+ ret str:: char_at ( p, 0 u) == '/'
12
+ || ( str:: char_at ( p, 1 u) == ':' && str:: char_at ( p, 2 u) == '\\' ) ;
13
+ }
14
+
10
15
/* FIXME: win32 path handling actually accepts '/' or '\' and has subtly
11
16
* different semantics for each. Since we build on mingw, we are usually
12
17
* dealing with /-separated paths. But the whole interface to splitting and
You can’t perform that action at this time.
0 commit comments