 |
Changeset 3843
- Timestamp:
- 08/03/08 16:53:10
(4 months ago)
- Author:
- kris
- Message:
fixes #1210 :: Path.standard does not convert
FilePath? does automatic conversion of '\' into '/', since it represents a mutable path. Path.parse(), on the other hand, does not since it has only a char[] to deal with. Const will perhaps make a mockery of this :(
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3840 |
r3843 |
|
| 614 | 614 | /*********************************************************************** |
|---|
| 615 | 615 | |
|---|
| 616 | | Parse the path spec |
|---|
| | 616 | Parse the path spec, and mutate '\' into '/' as necessary |
|---|
| 617 | 617 | |
|---|
| 618 | 618 | ***********************************************************************/ |
|---|
| … | … | |
| 620 | 620 | private final FilePath parse () |
|---|
| 621 | 621 | { |
|---|
| 622 | | p.parse (p.fp, p.end_); |
|---|
| | 622 | p.parse (p.fp, p.end_, true); |
|---|
| 623 | 623 | return this; |
|---|
| 624 | 624 | } |
|---|
| … | … | |
| 1352 | 1352 | fp = new FilePath(r"C:/foo/bar/test.bar"); |
|---|
| 1353 | 1353 | assert (fp.path == "C:/foo/bar/"); |
|---|
| 1354 | | fp = new FilePath(r"C:/foo/bar/test.bar"); |
|---|
| | 1354 | fp = new FilePath(r"C:\foo\bar\test.bar"); |
|---|
| 1355 | 1355 | assert (fp.path == r"C:/foo/bar/"); |
|---|
| 1356 | 1356 | |
|---|
| r3840 |
r3843 |
|
| 934 | 934 | PathParser parse (char[] path) |
|---|
| 935 | 935 | { |
|---|
| 936 | | return parse (path, path.length); |
|---|
| | 936 | return parse (path, path.length, false); |
|---|
| 937 | 937 | } |
|---|
| 938 | 938 | |
|---|
| … | … | |
| 1142 | 1142 | ***********************************************************************/ |
|---|
| 1143 | 1143 | |
|---|
| 1144 | | package PathParser parse (char[] path, uint end) |
|---|
| | 1144 | package PathParser parse (char[] path, uint end, bool mutate) |
|---|
| 1145 | 1145 | { |
|---|
| 1146 | 1146 | end_ = end; |
|---|
| … | … | |
| 1158 | 1158 | break; |
|---|
| 1159 | 1159 | |
|---|
| | 1160 | case '\\': |
|---|
| | 1161 | if (mutate is false) |
|---|
| | 1162 | throw new IOException ("unexpected '\\' character in path: "~path); |
|---|
| | 1163 | else |
|---|
| | 1164 | fp[i] = '/'; |
|---|
| | 1165 | // fall through! |
|---|
| | 1166 | |
|---|
| 1160 | 1167 | case FileConst.PathSeparatorChar: |
|---|
| 1161 | 1168 | if (name_ < 0) |
|---|
| 1162 | 1169 | name_ = i + 1; |
|---|
| 1163 | 1170 | break; |
|---|
| 1164 | | |
|---|
| 1165 | | case '\\': |
|---|
| 1166 | | throw new IOException ("unexpected '\\' character in path: "~path); |
|---|
| 1167 | 1171 | |
|---|
| 1168 | 1172 | version (Win32) |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic