PCFilename.st
changeset 8753 a134e378d5f5
parent 8661 2a7e152604fb
child 8785 b042196465e3
equal deleted inserted replaced
8752:3e7429854c55 8753:a134e378d5f5
    95      redefined to always return an MSDOS 8+3 fileName,
    95      redefined to always return an MSDOS 8+3 fileName,
    96      in case the tempFile is passed to an OLD dos utility.."
    96      in case the tempFile is passed to an OLD dos utility.."
    97 
    97 
    98     |pid nr nameString|
    98     |pid nr nameString|
    99 
    99 
   100     (self ~~ ConcreteClass) ifTrue:[
       
   101 	^ ConcreteClass newTemporaryIn:aDirectoryPrefix
       
   102     ].
       
   103 
       
   104     "/ although the above allows things to be redefined in concrete classes,
       
   105     "/ the following should work on all systems ...
       
   106 
       
   107     NextTempFilenameIndex isNil ifTrue:[
   100     NextTempFilenameIndex isNil ifTrue:[
   108 	NextTempFilenameIndex := 1.
   101         NextTempFilenameIndex := 1.
   109     ].
   102     ].
   110 
   103 
   111     pid := OperatingSystem getProcessId printString.
   104     pid := OperatingSystem getProcessId printString.
   112     pid := pid copyLast:(3 min:pid size).
   105     pid := pid copyLast:(3 min:pid size).
   113     nr := NextTempFilenameIndex printString.
   106     nr := NextTempFilenameIndex printString.
   114     nr := nr copyLast:(3 min:nr size).
   107     nr := nr copyLast:(3 min:nr size).
   115     nameString := (self tempFileNameTemplate)
   108     nameString := (self tempFileNameTemplate)
   116 		  bindWith:pid 
   109                   bindWith:pid 
   117 		  with:nr.
   110                   with:nr.
   118     NextTempFilenameIndex := NextTempFilenameIndex + 1.
   111     NextTempFilenameIndex := NextTempFilenameIndex + 1.
   119 
   112 
   120     (aDirectoryPrefix isNil or:[aDirectoryPrefix asString isEmpty]) ifFalse:[
   113     (aDirectoryPrefix isNil or:[aDirectoryPrefix asString isEmpty]) ifFalse:[
   121 	^ aDirectoryPrefix asFilename construct:nameString
   114         ^ aDirectoryPrefix asFilename construct:nameString
   122     ].
   115     ].
   123     ^ self named:nameString
   116     ^ self named:nameString
   124 
   117 
   125     "temp files in '/tmp':
   118     "temp files in '/tmp':
   126 
   119 
   229     "return true, if filenames are case sensitive."
   222     "return true, if filenames are case sensitive."
   230 
   223 
   231     ^ false
   224     ^ false
   232 !
   225 !
   233 
   226 
       
   227 nullFilename
       
   228     "Return the OS dependent filename for the data sink, or nil if there is none"
       
   229 
       
   230     ^ 'nul:'
       
   231 !
       
   232 
       
   233 parentDirectoryName
       
   234     "return the name used for the parent directory.
       
   235      This is '..' for unix and dos-like systems.
       
   236      (there may be more in the future."
       
   237 
       
   238     ^ '..'
       
   239 !
       
   240 
   234 separator
   241 separator
   235     "return the file/directory separator."
   242     "return the file/directory separator."
   236 
   243 
   237      ^ $\
   244      ^ $\
   238 
   245 
   722 ! !
   729 ! !
   723 
   730 
   724 !PCFilename class methodsFor:'documentation'!
   731 !PCFilename class methodsFor:'documentation'!
   725 
   732 
   726 version
   733 version
   727     ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.27 2004-12-15 10:31:29 penk Exp $'
   734     ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.28 2005-02-23 11:51:54 stefan Exp $'
   728 ! !
   735 ! !