FileDirectory.st
changeset 54 06dbdeeed4f9
parent 31 75f2b9f78be2
child 88 81dacba7a63a
equal deleted inserted replaced
53:77ed1ef5c018 54:06dbdeeed4f9
    24 
    24 
    25 FileDirectories represent directories in the underlying host system.
    25 FileDirectories represent directories in the underlying host system.
    26 They provide various methods to create/delete and query for files and/or
    26 They provide various methods to create/delete and query for files and/or
    27 directories.
    27 directories.
    28 
    28 
    29 $Header: /cvs/stx/stx/libbasic/FileDirectory.st,v 1.8 1994-01-08 16:18:31 claus Exp $
    29 $Header: /cvs/stx/stx/libbasic/FileDirectory.st,v 1.9 1994-02-25 12:57:50 claus Exp $
    30 
    30 
    31 written winter 89 by claus
    31 written winter 89 by claus
    32 '!
    32 '!
    33 
    33 
    34 !FileDirectory class methodsFor:'initialization'!
    34 !FileDirectory class methodsFor:'initialization'!
   327     (newFileName startsWith:'/') ifTrue:[
   327     (newFileName startsWith:'/') ifTrue:[
   328         path2 := newFileName
   328         path2 := newFileName
   329     ] ifFalse:[
   329     ] ifFalse:[
   330         path2 := (pathName , '/' , newFileName)
   330         path2 := (pathName , '/' , newFileName)
   331     ].
   331     ].
   332     ^ OperatingSystem link:path1 to:path2
   332     ^ OperatingSystem linkFile:path1 to:path2
   333 !
   333 !
   334 
   334 
   335 renameFile:oldFileName newName:newFileName
   335 renameFile:oldFileName newName:newFileName
   336     "rename the file; return true if successful"
   336     "rename the file; return true if successful"
   337 
   337 
   345     (newFileName startsWith:'/') ifTrue:[
   345     (newFileName startsWith:'/') ifTrue:[
   346         path2 := newFileName
   346         path2 := newFileName
   347     ] ifFalse:[
   347     ] ifFalse:[
   348         path2 := (pathName , '/' , newFileName)
   348         path2 := (pathName , '/' , newFileName)
   349     ].
   349     ].
   350     ^ OperatingSystem rename:path1 to:path2
   350     ^ OperatingSystem renameFile:path1 to:path2
   351 ! !
   351 ! !
   352 
   352 
   353 !FileDirectory methodsFor:'queries'!
   353 !FileDirectory methodsFor:'queries'!
   354 
   354 
   355 id
   355 id
   549     [aStream atEnd] whileFalse:[
   549     [aStream atEnd] whileFalse:[
   550         line := aStream nextLine.
   550         line := aStream nextLine.
   551         line notNil ifTrue:[
   551         line notNil ifTrue:[
   552             (line = '.') ifFalse:[
   552             (line = '.') ifFalse:[
   553                 "cut off initial ./"
   553                 "cut off initial ./"
   554                 line := line copyFrom:3 to:(line size)
   554                 line := line copyFrom:3
   555             ].
   555             ].
   556             aBlock value:line
   556             aBlock value:line
   557         ]
   557         ]
   558     ].
   558     ].
   559     aStream close
   559     aStream close
   572     [aStream atEnd] whileFalse:[
   572     [aStream atEnd] whileFalse:[
   573         line := aStream nextLine.
   573         line := aStream nextLine.
   574         line notNil ifTrue:[
   574         line notNil ifTrue:[
   575             (line = '.') ifFalse:[
   575             (line = '.') ifFalse:[
   576                 "cut off initial ./"
   576                 "cut off initial ./"
   577                 line := line copyFrom:3 to:(line size)
   577                 line := line copyFrom:3
   578             ].
   578             ].
   579             aBlock value:line
   579             aBlock value:line
   580         ]
   580         ]
   581     ].
   581     ].
   582     aStream close
   582     aStream close