This gives a meaning to FileSegments with a relative path. They are made relative to the kernel path.

The next patch will use this, so that when you relocate the package the paths from the image to the kernel directory still work. The idea is to make sure that all such paths are kept in relative form.

Paolo

2008-03-15  Paolo Bonzini  <[EMAIL PROTECTED]>

       * kernel/FileSegment.st: Add a warning that relative FileSegments
       are always interpreted from the kernel directory, and apply this
       rule in #fileName.

diff --git a/kernel/FileSegment.st b/kernel/FileSegment.st
index a767e8b..cd66729 100644
--- a/kernel/FileSegment.st
+++ b/kernel/FileSegment.st
@@ -57,7 +57,10 @@ Smalltalk-80 kernel; I am specific to the GNU Smalltalk implementation.'>

     FileSegment class >> on: aFile startingAt: startPos for: sizeInteger [
"Create a new FileSegment referring to the contents of the given file,
-        from the startPos-th byte and for sizeInteger bytes"
+        from the startPos-th byte and for sizeInteger bytes.  Note that
+        FileSegments should always be created with full paths because
+        relative paths are interpreted to be relative to the kernel
+        directory."

        <category: 'basic'>
        ^self new
@@ -126,7 +129,7 @@ Smalltalk-80 kernel; I am specific to the GNU Smalltalk implementation.'>
        "Answer the name of the file containing the segment"

        <category: 'basic'>
-       ^file
+       ^Directory append: file to: Directory kernel
     ]

     filePos [



_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to