author | Claus Gittinger <cg@exept.de> |
Fri, 29 Aug 2003 21:33:23 +0200 | |
changeset 1309 | c752d54f4e09 |
parent 1289 | a4744b1283d5 |
child 1310 | 948ed141b0b7 |
permissions | -rw-r--r-- |
1309 | 1 |
" |
2 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
1005 | 13 |
"{ Package: 'stx:libbasic2' }" |
14 |
||
15 |
URI subclass:#HierarchicalURI |
|
1257 | 16 |
instanceVariableNames:'authority isAbsolute isDirectory pathSegments query fragment' |
1005 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Resources' |
|
20 |
! |
|
21 |
||
22 |
!HierarchicalURI class methodsFor:'documentation'! |
|
23 |
||
1309 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 2002 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
1005 | 38 |
documentation |
39 |
" |
|
40 |
Hierarchical URI as defined in RFC2396: |
|
41 |
||
42 |
<scheme:[//authority][/absolute_path][?query][#fragment]> |
|
43 |
||
44 |
[author:] |
|
45 |
Stefan Vogel (stefan@zwerg) |
|
46 |
||
47 |
[see also:] |
|
48 |
||
49 |
[instance variables:] |
|
50 |
||
51 |
[class variables:] |
|
52 |
" |
|
53 |
! |
|
54 |
||
55 |
examples |
|
56 |
" |
|
57 |
||
58 |
more examples to be added: |
|
59 |
[exBegin] |
|
1254 | 60 |
|u1 u2| |
61 |
||
62 |
u1 := URI fromString:'file:/phys/exept/tmp/'. |
|
63 |
u2 := u1 construct:'test.txt'. |
|
64 |
Transcript showCR:u1. |
|
65 |
Transcript showCR:u2. |
|
66 |
[exEnd] |
|
67 |
||
68 |
[exBegin] |
|
69 |
|u1 u2| |
|
70 |
||
71 |
u1 := URI fromString:'file:/phys/exept/tmp'. |
|
72 |
u2 := u1 construct:'test.txt'. |
|
73 |
Transcript showCR:u1. |
|
74 |
Transcript showCR:u2. |
|
1005 | 75 |
[exEnd] |
76 |
" |
|
77 |
! ! |
|
78 |
||
79 |
!HierarchicalURI class methodsFor:'instance creation'! |
|
80 |
||
81 |
new |
|
82 |
||
83 |
^ self basicNew initialize |
|
84 |
! |
|
85 |
||
86 |
scheme:aSchemeString fromString:aString |
|
87 |
"parse the hierarchical information. |
|
88 |
schemeString is ignored here" |
|
89 |
||
90 |
^ self new scheme:aSchemeString; |
|
91 |
fromString:aString |
|
92 |
! ! |
|
93 |
||
94 |
!HierarchicalURI methodsFor:'accessing'! |
|
95 |
||
96 |
authority |
|
97 |
"return the value of the instance variable 'authority' (automatically generated)" |
|
98 |
||
99 |
^ authority |
|
100 |
! |
|
101 |
||
102 |
authority:something |
|
103 |
"set the value of the instance variable 'authority' (automatically generated)" |
|
104 |
||
105 |
authority := something. |
|
106 |
! |
|
107 |
||
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
108 |
baseName |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
109 |
^ pathSegments last |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
110 |
! |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
111 |
|
1254 | 112 |
examples |
113 |
" |
|
114 |
||
115 |
more examples to be added: |
|
116 |
[exBegin] |
|
117 |
URI fromString:'file:/phys/exept/home/tm/tmp' |
|
118 |
[exEnd] |
|
119 |
" |
|
120 |
! |
|
121 |
||
1005 | 122 |
fragment |
123 |
"return the value of the instance variable 'fragment' (automatically generated)" |
|
124 |
||
125 |
^ fragment |
|
126 |
! |
|
127 |
||
128 |
fragment:something |
|
129 |
"set the value of the instance variable 'fragment' (automatically generated)" |
|
130 |
||
131 |
fragment := something. |
|
132 |
! |
|
133 |
||
134 |
isAbsolute |
|
135 |
"return the value of the instance variable 'isAbsolute' (automatically generated)" |
|
136 |
||
137 |
^ isAbsolute |
|
138 |
! |
|
139 |
||
1257 | 140 |
isDirectory |
141 |
"return the value of the instance variable 'isDirectory' (automatically generated)" |
|
142 |
||
143 |
^ isDirectory ? false |
|
144 |
! |
|
145 |
||
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
146 |
pathSegments |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
147 |
"return the value of the instance variable 'pathSegments' (automatically generated)" |
1005 | 148 |
|
149 |
^ pathSegments |
|
150 |
! |
|
151 |
||
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
152 |
pathSegments:something |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
153 |
"set the value of the instance variable 'pathSegments' (automatically generated)" |
1005 | 154 |
|
155 |
pathSegments := something. |
|
156 |
! |
|
157 |
||
158 |
query |
|
159 |
"return the value of the instance variable 'query' (automatically generated)" |
|
160 |
||
161 |
^ query |
|
162 |
! |
|
163 |
||
164 |
query:something |
|
165 |
"set the value of the instance variable 'query' (automatically generated)" |
|
166 |
||
167 |
query := something. |
|
168 |
! ! |
|
169 |
||
170 |
!HierarchicalURI methodsFor:'accessing-details'! |
|
171 |
||
172 |
host |
|
173 |
"answer the host part of authority" |
|
174 |
||
175 |
|start end| |
|
176 |
||
177 |
authority isNil ifTrue:[ |
|
178 |
^ nil |
|
179 |
]. |
|
180 |
start := (authority indexOf:$@) + 1. |
|
181 |
end := (authority indexOf:$: startingAt:start) - 1. |
|
182 |
end == -1 ifTrue:[ |
|
183 |
end := authority size |
|
184 |
]. |
|
185 |
^ authority copyFrom:start to:end |
|
186 |
||
187 |
" |
|
188 |
(self fromString:'ftp://stefan@www.exept.de:80/test') host |
|
189 |
(self fromString:'ftp://www.exept.de:80/test') host |
|
190 |
(self fromString:'ftp://www.exept.de/test') host |
|
191 |
" |
|
192 |
! |
|
193 |
||
194 |
password |
|
195 |
"answer the user part of authority" |
|
196 |
||
197 |
|end start| |
|
198 |
||
199 |
authority isNil ifTrue:[ |
|
200 |
^ nil |
|
201 |
]. |
|
202 |
end := authority indexOf:$@. |
|
203 |
end == 0 ifTrue:[ |
|
204 |
^ nil |
|
205 |
]. |
|
206 |
start := authority indexOf:$:. |
|
207 |
(start == 0 or:[start > end]) ifTrue:[ |
|
208 |
^ nil |
|
209 |
]. |
|
210 |
^ authority copyFrom:start+1 to:end-1 |
|
211 |
||
212 |
" |
|
213 |
(self fromString:'ftp://stefan@www.exept.de:80/test') password |
|
214 |
(self fromString:'ftp://stefan:pass@www.exept.de:80/test') password |
|
215 |
(self fromString:'ftp://www.exept.de:80/test') password |
|
216 |
" |
|
217 |
! |
|
218 |
||
219 |
port |
|
220 |
"answer the port part of authority" |
|
221 |
||
222 |
|start| |
|
223 |
||
224 |
authority isNil ifTrue:[ |
|
225 |
^ self defaultPort |
|
226 |
]. |
|
227 |
start := authority indexOf:$@. |
|
228 |
start := authority indexOf:$: startingAt:start. |
|
229 |
start == 0 ifTrue:[ |
|
230 |
^ self defaultPort |
|
231 |
]. |
|
232 |
||
233 |
^ authority copyFrom:start+1 |
|
234 |
||
235 |
" |
|
236 |
(self fromString:'ftp://stefan@www.exept.de:80/test') port |
|
237 |
(self fromString:'ftp://www.exept.de:80/test') port |
|
238 |
(self fromString:'ftp://www.exept.de/test') port |
|
239 |
" |
|
240 |
! |
|
241 |
||
242 |
user |
|
243 |
"answer the user part of authority" |
|
244 |
||
245 |
|end end1| |
|
246 |
||
247 |
authority isNil ifTrue:[ |
|
248 |
^ nil |
|
249 |
]. |
|
250 |
end := authority indexOf:$@. |
|
251 |
end == 0 ifTrue:[ |
|
252 |
^ nil |
|
253 |
]. |
|
254 |
end1 := authority indexOf:$:. |
|
255 |
end1 ~~ 0 ifTrue:[ |
|
256 |
end := end min:end1. |
|
257 |
]. |
|
258 |
^ authority copyTo:end-1 |
|
259 |
||
260 |
" |
|
261 |
(self fromString:'ftp://stefan@www.exept.de:80/test') user |
|
262 |
(self fromString:'ftp://stefan:pass@www.exept.de:80/test') user |
|
263 |
(self fromString:'ftp://www.exept.de:80/test') user |
|
264 |
" |
|
265 |
! ! |
|
266 |
||
1289 | 267 |
!HierarchicalURI methodsFor:'comparing'! |
268 |
||
269 |
= anHierarchicalUri |
|
270 |
||
271 |
^ self class == anHierarchicalUri class |
|
272 |
and:[self scheme = anHierarchicalUri scheme |
|
273 |
and:[pathSegments = anHierarchicalUri pathSegments |
|
274 |
and:[authority = anHierarchicalUri authority |
|
275 |
and:[self isAbsolute = anHierarchicalUri isAbsolute |
|
276 |
and:[self isDirectory = anHierarchicalUri isDirectory |
|
277 |
and:[query = anHierarchicalUri query |
|
278 |
and:[fragment = anHierarchicalUri fragment]]]]]]] |
|
279 |
! |
|
280 |
||
281 |
hash |
|
282 |
||
283 |
^ pathSegments hash xor:query hash |
|
284 |
! ! |
|
285 |
||
1254 | 286 |
!HierarchicalURI methodsFor:'copying'! |
287 |
||
288 |
postCopy |
|
289 |
||
290 |
pathSegments := pathSegments copy |
|
291 |
! ! |
|
292 |
||
1005 | 293 |
!HierarchicalURI methodsFor:'defaults'! |
294 |
||
295 |
defaultPort |
|
296 |
"answer the default port for the given scheme. |
|
297 |
Concrete subclasses redefine this method" |
|
298 |
||
299 |
^ nil |
|
300 |
! ! |
|
301 |
||
302 |
!HierarchicalURI methodsFor:'escape'! |
|
303 |
||
304 |
unEscape |
|
305 |
"convert escaped characters (such as %20 for ' ') to their native |
|
306 |
representation" |
|
307 |
||
308 |
authority := self class unEscape:authority readStream. |
|
309 |
pathSegments keysAndValuesDo:[:i :v| |
|
310 |
pathSegments at:i put:(self class unEscape:v readStream). |
|
311 |
]. |
|
312 |
query := self class unEscape:query readStream. |
|
313 |
fragment := self class unEscape:fragment readStream. |
|
314 |
! ! |
|
315 |
||
316 |
!HierarchicalURI methodsFor:'initialize'! |
|
317 |
||
318 |
fromString:aString |
|
319 |
||
320 |
|i i1 separator| |
|
321 |
||
322 |
(aString startsWith:'//') ifTrue:[ |
|
1268 | 323 |
i := aString indexOfAny:'/?#' startingAt:3. |
1005 | 324 |
i == 0 ifTrue:[ |
325 |
authority := aString copyFrom:3. |
|
326 |
^ self. |
|
327 |
] ifFalse:[ |
|
328 |
separator := aString at:i. |
|
329 |
authority := aString copyFrom:3 to:i-1. |
|
330 |
]. |
|
1267 | 331 |
(isAbsolute := (aString at:i) == $/). |
1005 | 332 |
] ifFalse:[ |
333 |
(isAbsolute := aString startsWith:$/) ifTrue:[ |
|
334 |
i := 1. |
|
335 |
] ifFalse:[ |
|
336 |
i := 0. |
|
337 |
] |
|
338 |
]. |
|
339 |
||
340 |
[ |
|
341 |
i1 := aString indexOfAny:'/?#' startingAt:i+1. |
|
1254 | 342 |
i1 == 0 ifTrue:[ |path| |
343 |
path := aString copyFrom:i+1. |
|
344 |
path size ~~ 0 ifTrue:[ |
|
345 |
pathSegments add:path. |
|
1257 | 346 |
] ifFalse:[ |
347 |
(aString at:i) == $/ ifTrue:[ |
|
348 |
isDirectory := true |
|
349 |
]. |
|
1254 | 350 |
]. |
1005 | 351 |
^ self. |
352 |
] ifFalse:[ |
|
353 |
separator := aString at:i1. |
|
354 |
pathSegments add:(aString copyFrom:i+1 to:i1-1). |
|
1267 | 355 |
isAbsolute ifTrue:[ |
356 |
pathSegments size == 1 ifTrue:[ |
|
1268 | 357 |
(pathSegments first startsWith:$~) ifTrue:[ |
1267 | 358 |
isAbsolute := false |
359 |
]. |
|
360 |
]. |
|
361 |
]. |
|
1005 | 362 |
i := i1. |
363 |
]. |
|
364 |
] doWhile:[separator == $/]. |
|
365 |
||
366 |
separator == $? ifTrue:[ |
|
367 |
i1 := aString indexOf:$# startingAt:i+1. |
|
368 |
i1 == 0 ifTrue:[ |
|
369 |
query := aString copyFrom:i+1. |
|
370 |
^ self. |
|
371 |
] ifFalse:[ |
|
372 |
separator := aString at:i1. |
|
373 |
query := aString copyFrom:i+1 to:i1-1. |
|
374 |
i := i1. |
|
375 |
]. |
|
376 |
]. |
|
377 |
separator == $# ifTrue:[ |
|
378 |
fragment := aString copyFrom:i+1. |
|
379 |
]. |
|
380 |
||
381 |
" |
|
1267 | 382 |
self new fromString:'//exept~/tmp' |
383 |
self new fromString:'~/tmp' |
|
384 |
self new fromString:'/~/tmp' |
|
1257 | 385 |
self new fromString:'//authority/path1/path2/' |
1005 | 386 |
self new fromString:'//authority/path1/path2?query' |
387 |
self new fromString:'//authority/path1/path2?query#fragment' |
|
388 |
self new fromString:'/path1/path2?query#fragment' |
|
389 |
self new fromString:'/path1/path2#fragment' |
|
390 |
self new fromString:'path1/path2#fragment' |
|
391 |
" |
|
392 |
! |
|
393 |
||
394 |
initialize |
|
395 |
||
396 |
pathSegments := OrderedCollection new. |
|
397 |
! ! |
|
398 |
||
399 |
!HierarchicalURI methodsFor:'printing & storing'! |
|
400 |
||
1268 | 401 |
directoryPath |
402 |
"answer the directory path part of the URI" |
|
403 |
||
404 |
|aStream| |
|
405 |
||
406 |
aStream := WriteStream on:''. |
|
407 |
||
408 |
pathSegments size ~~ 0 ifTrue: [ |
|
409 |
self isAbsolute ifTrue:[ |
|
410 |
aStream nextPut:$/. |
|
411 |
]. |
|
412 |
pathSegments size > 1 ifTrue:[ |
|
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
413 |
(pathSegments copyTo:pathSegments size-1) do:[:p| |
1268 | 414 |
self class escape:p allow:'~;:@&=+",' on:aStream |
415 |
] separatedBy:[ |
|
416 |
aStream nextPut:$/ |
|
417 |
]. |
|
418 |
]. |
|
419 |
]. |
|
420 |
||
421 |
^ aStream contents |
|
422 |
! |
|
423 |
||
1005 | 424 |
path |
425 |
"answer the path part of the URI" |
|
426 |
||
427 |
|aStream| |
|
428 |
||
429 |
aStream := WriteStream on:''. |
|
430 |
||
431 |
pathSegments size ~~ 0 ifTrue: [ |
|
1268 | 432 |
self isAbsolute ifTrue:[ |
1005 | 433 |
aStream nextPut:$/. |
434 |
]. |
|
435 |
pathSegments do:[:p| |
|
1268 | 436 |
self class escape:p allow:'~;:@&=+",' on:aStream |
1005 | 437 |
] separatedBy:[ |
438 |
aStream nextPut:$/ |
|
439 |
]. |
|
440 |
]. |
|
441 |
query notNil ifTrue: [ |
|
442 |
aStream nextPut:$?. |
|
443 |
self class escape:query allow:nil on:aStream |
|
444 |
]. |
|
445 |
fragment notNil ifTrue: [ |
|
446 |
aStream nextPut:$#. |
|
447 |
self class escape:fragment allow:nil on:aStream |
|
448 |
]. |
|
449 |
||
450 |
^ aStream contents |
|
451 |
! |
|
452 |
||
453 |
printOn:aStream |
|
454 |
||
455 |
self printOn:aStream escape:false |
|
456 |
! |
|
457 |
||
458 |
printOn:aStream escape:doEscape |
|
459 |
"print the URI on aStream. If doEscape is set, escape special |
|
460 |
characters" |
|
461 |
||
462 |
super printOn:aStream. |
|
463 |
authority notNil ifTrue: [ |
|
464 |
aStream nextPutAll:'//'. |
|
465 |
doEscape ifTrue:[ |
|
1268 | 466 |
self class escape:authority allow:'~$,;:@&=+' on:aStream |
1005 | 467 |
] ifFalse:[ |
468 |
aStream nextPutAll:authority |
|
469 |
] |
|
470 |
]. |
|
1276 | 471 |
|
472 |
self printPathOn:aStream escape:doEscape. |
|
473 |
! |
|
474 |
||
475 |
printPathOn:aStream escape:doEscape |
|
476 |
"print the path part" |
|
477 |
||
1005 | 478 |
pathSegments size ~~ 0 ifTrue: [ |
1268 | 479 |
self isAbsolute ifTrue:[ |
1005 | 480 |
aStream nextPut:$/. |
481 |
]. |
|
482 |
pathSegments do:[:p| |
|
483 |
doEscape ifTrue:[ |
|
1268 | 484 |
self class escape:p allow:'~;:@&=+",' on:aStream |
1005 | 485 |
] ifFalse:[ |
486 |
aStream nextPutAll:p |
|
487 |
] |
|
488 |
] separatedBy:[ |
|
489 |
aStream nextPut:$/ |
|
490 |
]. |
|
491 |
]. |
|
492 |
query notNil ifTrue: [ |
|
493 |
aStream nextPut:$?. |
|
494 |
doEscape ifTrue:[ |
|
495 |
self class escape:query allow:nil on:aStream |
|
496 |
] ifFalse:[ |
|
497 |
aStream nextPutAll:query |
|
498 |
] |
|
499 |
||
500 |
]. |
|
501 |
fragment notNil ifTrue: [ |
|
502 |
aStream nextPut:$#. |
|
503 |
doEscape ifTrue:[ |
|
504 |
self class escape:fragment allow:nil on:aStream |
|
505 |
] ifFalse:[ |
|
506 |
aStream nextPutAll:fragment |
|
507 |
] |
|
508 |
]. |
|
1276 | 509 |
! |
510 |
||
511 |
publicPrintOn:aStream |
|
512 |
"print, but omit password information" |
|
513 |
||
514 |
|password| |
|
515 |
||
516 |
password := self password. |
|
517 |
password size ~~ 0 ifTrue:[ |
|
1277 | 518 |
super printOn:aStream. |
1276 | 519 |
aStream |
520 |
nextPutAll:'//'; |
|
521 |
nextPutAll:self user; |
|
522 |
nextPut:$@; |
|
523 |
nextPutAll:self host. |
|
1277 | 524 |
self printPathOn:aStream escape:true. |
525 |
] ifFalse:[ |
|
526 |
"no password, use normal printing" |
|
527 |
self printOn:aStream |
|
1276 | 528 |
]. |
1005 | 529 |
! ! |
530 |
||
531 |
!HierarchicalURI methodsFor:'resolution'! |
|
532 |
||
533 |
addComponent:aString |
|
534 |
"concatenate aString to my path" |
|
535 |
||
536 |
(aString = '..' |
|
537 |
and:[pathSegments size ~~ 0 |
|
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
538 |
and:[pathSegments last ~= '..']]) ifTrue:[ |
1005 | 539 |
pathSegments removeLast. |
540 |
] ifFalse:[ |
|
541 |
pathSegments add:aString |
|
542 |
]. |
|
543 |
! |
|
544 |
||
545 |
construct:aString |
|
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
546 |
"concatenate aString to my path" |
1005 | 547 |
|
548 |
^ self copy |
|
549 |
addComponent:aString; |
|
550 |
yourself. |
|
1271
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
551 |
! |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
552 |
|
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
553 |
directory |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
554 |
"remove the last path component" |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
555 |
|
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
556 |
^ self copy |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
557 |
removeLastComponent; |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
558 |
yourself. |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
559 |
! |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
560 |
|
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
561 |
removeLastComponent |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
562 |
"remove the last component" |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
563 |
|
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
564 |
pathSegments size ~~ 0 ifTrue:[ |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
565 |
pathSegments last = '..' ifTrue:[ |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
566 |
pathSegments add:'..'. |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
567 |
] ifFalse:[ |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
568 |
pathSegments removeLast. |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
569 |
]. |
ca2e206e7c7f
Working version: tilde-expansion, patterns
Stefan Vogel <sv@exept.de>
parents:
1268
diff
changeset
|
570 |
]. |
1005 | 571 |
! ! |
572 |
||
573 |
!HierarchicalURI class methodsFor:'documentation'! |
|
574 |
||
575 |
version |
|
1309 | 576 |
^ '$Header: /cvs/stx/stx/libbasic2/HierarchicalURI.st,v 1.10 2003-08-29 19:33:23 cg Exp $' |
1005 | 577 |
! ! |