help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Re: Building in mingw (3.0.2)


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Re: Building in mingw (3.0.2)
Date: Tue, 15 Apr 2008 10:51:09 +0200
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

The bug occurs because your installation drive is different from the compilation drive. The attached patch will fix it.

Paolo
2008-04-15  Paolo Bonzini  <address@hidden>

        * kernel/File.st: Don't prepend a \ if an absolute path is
        created by #computePathFrom:to: and the destination path has a
        disk letter in it.

diff --git a/kernel/File.st b/kernel/File.st
index 9170a3d..063e916 100644
--- a/kernel/File.st
+++ b/kernel/File.st
@@ -192,13 +192,14 @@ size and timestamps.'>
 
     File class >> computePathFrom: srcName to: destName [
        <category: 'private'>
-       | src dest srcCanon destCanon path |
+       | src dest srcCanon destCanon path isUnix |
        "A Windows path may contain both / and \ separators. Clean it up
         to allow easy parsing"
-       srcCanon := Directory pathSeparator = $/ 
+       isUnix := Directory pathSeparator = $/.
+       srcCanon := isUnix
                    ifTrue: [srcName]
                    ifFalse: [srcName copyReplacing: $/ withObject: Directory 
pathSeparator].
-       destCanon := Directory pathSeparator = $/ 
+       destCanon := isUnix
                    ifTrue: [destName]
                    ifFalse: [destName copyReplacing: $/ withObject: Directory 
pathSeparator].
 
@@ -208,14 +209,19 @@ size and timestamps.'>
        src removeLast.
        dest := dest asOrderedCollection.
        dest isEmpty ifTrue: [dest addLast: ''].
-       path := (src notEmpty and: [src first ~= dest first]) 
+       path := (src notEmpty and: [src first ~= dest first])
+           ifTrue: [
+               "Don't prepend a \ if the destination path has a disk letter."
+               (isUnix or: [ (dest first at: 2 ifAbsent: [ nil ]) ~= $: ]) 
                    ifTrue: [OrderedCollection with: '']
-                   ifFalse: 
-                       [[src isEmpty or: [dest size = 1 or: [src first ~= dest 
first]]] 
-                           whileFalse: 
-                               [src removeFirst.
-                               dest removeFirst].
-                       src collect: [:each | '..']].
+                   ifFalse: [OrderedCollection new]]
+           ifFalse: 
+               [[src isEmpty or: [dest size = 1 or: [src first ~= dest 
first]]] 
+                   whileFalse: 
+                       [src removeFirst.
+                       dest removeFirst].
+               src collect: [:each | '..']].
+
        path addAllLast: dest.
        ^path fold: [:a :b | a , Directory pathSeparatorString , b]
     ]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]