PCFilename.st
branchjv
changeset 17955 f5ee690b1a27
parent 17911 a99f15c5efa5
child 18011 deb0c3355881
--- a/PCFilename.st	Fri Jul 20 14:32:04 2012 +0100
+++ b/PCFilename.st	Wed Jul 25 09:45:15 2012 +0100
@@ -813,7 +813,7 @@
     (nameString startsWith:'..\') ifTrue:[
         ^ self pathName
     ].
-    ^ nameString
+    ^ self osNameForFile
 !
 
 osNameForDirectory
@@ -822,13 +822,11 @@
      Care remove trailing backSlashes here and to use the shortName
      if available"
 
-    |n i shortName|
+    |n|
 
-    (nameString includes:$~) ifTrue:[
-        self makeNonDOSName
-    ].
+    n := self osNameForFile.
 
-    ((n := nameString) endsWith:'\') ifTrue:[
+    (n endsWith:'\') ifTrue:[
         ((n size == 3) and:[(n at:2) == $:]) ifFalse:[
             n := n copyWithoutLast:1
         ]
@@ -848,10 +846,13 @@
      access it as a directory for reading the contents.
      Care to remove trailing backSlashes here"
 
-    (nameString endsWith:'\') ifTrue:[
-        ^ nameString copyWithoutLast:1
+    |name|
+
+    name := self osNameForFile.
+    (name endsWith:'\') ifTrue:[
+        ^ name copyWithoutLast:1
     ].
-    ^ nameString
+    ^ name
 
     "Modified: / 20.1.1998 / 15:39:06 / md"
     "Created: / 3.8.1998 / 21:37:46 / cg"
@@ -859,20 +860,23 @@
 !
 
 osNameForFile
-    "special - return the OS's name for the receiver to
-     access it as a directory.
-     Care remove trailing backSlashes here and to use the shortName
-     if available"
+    "internal - return the OS's name for the receiver to
+     access it as a file."
 
     (nameString includes:$~) ifTrue:[
-        self makeNonDOSName
+        (nameString startsWith:'~') ifTrue:[
+            ^ self class nameWithSpecialExpansions:nameString. 
+        ].
+        "/ self makeNonDOSName.
     ].
 
     ^ nameString
+
+    "Modified: / 21-07-2012 / 19:35:19 / cg"
 !
 
 setName:aString
-    "set the filename"
+    "set the filename, convert unix directory separators to native separators"
 
     nameString := aString copy replaceAll:$/ with:$\
 
@@ -882,18 +886,13 @@
 !PCFilename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.55 2011/11/08 14:59:44 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.57 2012/07/22 08:06:13 cg Exp $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.55 2011/11/08 14:59:44 mb Exp '
+    ^ '§Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.57 2012/07/22 08:06:13 cg Exp §'
 !
 
 version_SVN
-    ^ '$Id: PCFilename.st 10761 2012-01-19 11:46:00Z vranyj1 $'
+    ^ '$Id: PCFilename.st 10829 2012-07-25 08:45:15Z vranyj1 $'
 ! !
-
-
-
-
-