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 |