class: StandardSystemView
changed: #windowLabelFor:
don't crash when stx package directory cannot
be found, is removed or unreadable.
--- a/StandardSystemView.st Wed Jun 11 11:30:29 2014 +0200
+++ b/StandardSystemView.st Wed Jun 11 15:59:15 2014 +0200
@@ -1390,33 +1390,43 @@
windowLabelFor:labelString
"return an expanded labelString, according to the hostName-in-window setting.
The labelString may include positional parameters:
- %1 - the actual label
- %2 - the hostname
- %3 - the userName
- %4 - the processId
- %5 - the TOP-directories name
- %6 - the TOP-directories path
+ %1 - the actual label
+ %2 - the hostname
+ %3 - the userName
+ %4 - the processId
+ %5 - the TOP-directories name
+ %6 - the TOP-directories path
"
- |wg proc id pidString lbl windowLabelFormat|
+ |wg proc id pidString lbl windowLabelFormat stxPackageDirectory topDirectory|
(IncludeHostNameInLabel == true
and:[(windowLabelFormat := self class windowLabelFormat) notNil]) ifTrue:[
- (wg := self windowGroup) notNil ifTrue:[
- (proc := wg process) notNil ifTrue:[
- (id := proc id) notNil ifTrue:[
- pidString := id printString
- ]
- ]
- ].
- lbl := windowLabelFormat
- bindWith:labelString
- with:[OperatingSystem getHostName]
- with:[OperatingSystem getLoginName]
- with:pidString
- with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory baseName]
- with:[(Smalltalk getPackageDirectoryForPackage:'stx') directory pathName].
- ^ lbl
+ (wg := self windowGroup) notNil ifTrue:[
+ (proc := wg process) notNil ifTrue:[
+ (id := proc id) notNil ifTrue:[
+ pidString := id printString
+ ]
+ ]
+ ].
+ stxPackageDirectory := Smalltalk getPackageDirectoryForPackage:'stx'.
+ stxPackageDirectory isNil ifTrue:[
+ 'StdSysView [info]: cannot figure out stx package directory.' infoPrintCR.
+ stxPackageDirectory := OperatingSystem pathOfSTXExecutable asFilename.
+ ].
+ stxPackageDirectory isNil ifTrue:[
+ topDirectory := OperatingSystem getHomeDirectory asFilename.
+ ] ifFalse:[
+ topDirectory := stxPackageDirectory directory.
+ ].
+ lbl := windowLabelFormat
+ bindWith:labelString
+ with:[OperatingSystem getHostName]
+ with:[OperatingSystem getLoginName]
+ with:pidString
+ with:[topDirectory baseName]
+ with:[topDirectory pathName].
+ ^ lbl
].
^ labelString
@@ -1699,11 +1709,11 @@
!StandardSystemView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.220 2014-05-23 08:27:42 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.221 2014-06-11 13:59:15 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.220 2014-05-23 08:27:42 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/StandardSystemView.st,v 1.221 2014-06-11 13:59:15 cg Exp $'
! !