LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package os | 5 package os |
6 | 6 |
7 import ( | 7 import ( |
8 intsyscall "internal/syscall" | |
9 "io" | 8 "io" |
10 "runtime" | 9 "runtime" |
11 "sync" | 10 "sync" |
12 "syscall" | 11 "syscall" |
13 "unicode/utf16" | 12 "unicode/utf16" |
14 "unicode/utf8" | 13 "unicode/utf8" |
15 "unsafe" | 14 "unsafe" |
16 ) | 15 ) |
17 | 16 |
18 // File represents an open file descriptor. | 17 // File represents an open file descriptor. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 if e != nil { | 110 if e != nil { |
112 return nil, e | 111 return nil, e |
113 } | 112 } |
114 if fa.FileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY == 0 { | 113 if fa.FileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY == 0 { |
115 return nil, e | 114 return nil, e |
116 } | 115 } |
117 d.isempty = true | 116 d.isempty = true |
118 } | 117 } |
119 d.path = name | 118 d.path = name |
120 if !isAbs(d.path) { | 119 if !isAbs(d.path) { |
121 » » d.path, e = intsyscall.FullPath(d.path) | 120 » » d.path, e = syscall.FullPath(d.path) |
122 if e != nil { | 121 if e != nil { |
123 return nil, e | 122 return nil, e |
124 } | 123 } |
125 } | 124 } |
126 f := newFile(r, name) | 125 f := newFile(r, name) |
127 f.dirinfo = d | 126 f.dirinfo = d |
128 return f, nil | 127 return f, nil |
129 } | 128 } |
130 | 129 |
131 // OpenFile is the generalized open call; most users will use Open | 130 // OpenFile is the generalized open call; most users will use Open |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 dir := path[len(vol) : i+1] | 586 dir := path[len(vol) : i+1] |
588 last := len(dir) - 1 | 587 last := len(dir) - 1 |
589 if last > 0 && IsPathSeparator(dir[last]) { | 588 if last > 0 && IsPathSeparator(dir[last]) { |
590 dir = dir[:last] | 589 dir = dir[:last] |
591 } | 590 } |
592 if dir == "" { | 591 if dir == "" { |
593 dir = "." | 592 dir = "." |
594 } | 593 } |
595 return vol + dir | 594 return vol + dir |
596 } | 595 } |
LEFT | RIGHT |