#REFACTORING
authorStefan Vogel <sv@exept.de>
Mon, 14 Mar 2016 18:47:07 +0100
changeset 19362 dd6ee6342985
parent 19361 650e52cb3ec8
child 19363 47bb171b4e69
#REFACTORING class: Filename changed: #newTemporaryIn:nameTemplate: use characters as random component
Filename.st
--- a/Filename.st	Mon Mar 14 18:44:38 2016 +0100
+++ b/Filename.st	Mon Mar 14 18:47:07 2016 +0100
@@ -629,29 +629,29 @@
     |nameString newTempFilename|
 
     self isAbstract ifTrue:[
-	^ ConcreteClass newTemporaryIn:aDirectoryOrNil nameTemplate:template
+        ^ ConcreteClass newTemporaryIn:aDirectoryOrNil nameTemplate:template
     ].
 
     "although the above allows things to be redefined in concrete classes,
      the following should work on all systems ..."
 
     [
-	"Use random numbers in order to improve the security
-	 by making the generated names less predictable"
-	nameString := template bindWith:(OperatingSystem getProcessId) with:RandomGenerator new nextInteger.
-
-	aDirectoryOrNil isNil ifTrue:[
-	    newTempFilename := self named:nameString
-	] ifFalse:[
-	    newTempFilename := aDirectoryOrNil asFilename construct:nameString
-	]
+        "Use random numbers in order to improve the security
+         by making the generated names less predictable"
+        nameString := template bindWith:(OperatingSystem getProcessId) with:(RandomGenerator nextLettersOrDigits:4).
+
+        aDirectoryOrNil isNil ifTrue:[
+            newTempFilename := self named:nameString
+        ] ifFalse:[
+            newTempFilename := aDirectoryOrNil asFilename construct:nameString
+        ]
     ] doWhile:[
-	"care for existing leftOver tempFiles
-	 from a previous boot of the OS
-	 i.e. my pid could be the same as when executed
-	 the last time before system reboot ...)"
-
-	newTempFilename exists
+        "care for existing leftOver tempFiles
+         from a previous boot of the OS
+         i.e. my pid could be the same as when executed
+         the last time before system reboot ...)"
+
+        newTempFilename exists
     ].
     ^ newTempFilename