Here is the bug that is breaking gst-package on mingw:
st> CSymbols.PathSeparator := $\
$\
st> File computePathFrom: 'C:/a\b\c' to: 'C:\a\e\f'
'/C:/a/e/f'
with the patch, obviously, it returns '..\e\f'.
There was a similar problem in File>>#fullNameFor: but it was already
fixed last June by Freddie Akeroyd.
Paolo
2008-02-13 Paolo Bonzini <
[hidden email]>
* kernel/File.st: Canonicalize names before finding directory
components.
diff --git a/kernel/File.st b/kernel/File.st
index 09ba2ce..bfa4ff6 100644
--- a/kernel/File.st
+++ b/kernel/File.st
@@ -192,9 +192,18 @@ size and timestamps.'>
File class >> computePathFrom: srcName to: destName [
<category: 'private'>
- | src dest srcComponent destComponent path |
- src := srcName subStrings: Directory pathSeparator.
- dest := destName subStrings: Directory pathSeparator.
+ | src dest srcCanon destCanon path |
+ "A Windows path may contain both / and \ separators. Clean it up
+ to allow easy parsing"
+ srcCanon := Directory pathSeparator = $/
+ ifTrue: [srcName]
+ ifFalse: [srcName copyReplacing: $/ withObject: Directory pathSeparator].
+ destCanon := Directory pathSeparator = $/
+ ifTrue: [destName]
+ ifFalse: [destName copyReplacing: $/ withObject: Directory pathSeparator].
+
+ src := srcCanon subStrings: Directory pathSeparator.
+ dest := destCanon subStrings: Directory pathSeparator.
src := src asOrderedCollection.
src removeLast.
dest := dest asOrderedCollection.
@@ -208,7 +217,7 @@ size and timestamps.'>
dest removeFirst].
src collect: [:each | '..']].
path addAllLast: dest.
- ^path fold: [:a :b | a , '/' , b]
+ ^path fold: [:a :b | a , Directory pathSeparatorString , b]
]
File class >> checkError [
_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk