equal
deleted
inserted
replaced
142 } |
142 } |
143 } |
143 } |
144 def append(path: String) |
144 def append(path: String) |
145 { |
145 { |
146 init(path) |
146 init(path) |
147 for (p <- path.split("/") if p != "") { |
147 for (p <- path.split("/") if p != "" && p != ".") { |
148 val len = result_path.length |
148 if (p == "..") { |
149 if (len > 0 && result_path(len - 1) != '/') |
149 val result = result_path.toString |
150 result_path += '/' |
150 val i = result.lastIndexOf("/") |
151 result_path ++= p |
151 if (result == "") |
|
152 result_path ++= ".." |
|
153 else if (result.substring(i + 1) == "..") |
|
154 result_path ++= "/.." |
|
155 else if (i < 1) |
|
156 result_path.length = i + 1 |
|
157 else |
|
158 result_path.length = i |
|
159 } |
|
160 else { |
|
161 val len = result_path.length |
|
162 if (len > 0 && result_path(len - 1) != '/') |
|
163 result_path += '/' |
|
164 result_path ++= p |
|
165 } |
152 } |
166 } |
153 } |
167 } |
154 init(source_path) |
168 init(source_path) |
155 for (p <- source_path.split("/")) { |
169 for (p <- source_path.split("/")) { |
156 if (p.startsWith("$")) append(getenv_strict(p.substring(1))) |
170 if (p.startsWith("$")) append(getenv_strict(p.substring(1))) |