--- a/Win32OperatingSystem.st Tue Aug 07 10:01:07 2018 +0200
+++ b/Win32OperatingSystem.st Tue Aug 07 21:51:44 2018 +0200
@@ -1019,6 +1019,7 @@
"Modified: 7.1.1997 / 19:36:11 / stefan"
! !
+
!Win32OperatingSystem class methodsFor:'OS signal constants'!
sigABRT
@@ -6006,20 +6007,24 @@
!
getFileInfos:infoKeys fromFile:filename
- "Retrieve version information from filename and return a dictionary with values for keys in infoKeys"
+ "Retrieve version information from filename and return a dictionary with values for keys in infoKeys.
+ Returns nil, if fileInfo cannot be extracted."
+
|bytes vfi lang codePage sfi assocs|
bytes := self getFileVersionInfoOf:(filename asFilename pathName).
+ bytes isEmptyOrNil ifTrue:[^ nil].
+
self extractVersionValue:'\' from:bytes.
vfi := self extractVersionValue:'\VarFileInfo\Translation' from:bytes.
lang := vfi unsignedInt16At:1.
codePage := vfi unsignedInt16At:3.
assocs := infoKeys collect:[:each |
sfi := self extractVersionValue:('\StringFileInfo\%1%2\%3'
- bindWith:(lang hexPrintString:4)
- with:(codePage hexPrintString:4)
- with:each)
- from:bytes.
+ bindWith:(lang hexPrintString:4)
+ with:(codePage hexPrintString:4)
+ with:each)
+ from:bytes.
each -> (sfi zeroByteStringAt:1 maximumSize:999)
].
^ Dictionary withAssociations:assocs