#TUNING by cg
class: AbstractSourceCodeManager
comment/format in:
#availableManagers
#cacheDirectoryName:
changed:5 methods
lazy setup of source cache directory
--- a/AbstractSourceCodeManager.st Fri Apr 01 23:53:05 2016 +0200
+++ b/AbstractSourceCodeManager.st Thu Apr 07 19:41:50 2016 +0200
@@ -72,14 +72,17 @@
~/.smalltalk/source-cache (UNIX, as <tempDir> is pruned upon each reboot)
"
"JV@2012-03-14: Changed to use .smalltalk/source-cache on UNIX machines"
-
+ "CG: why only on unix machines???"
+
+ CachingSources isNil ifTrue:[
+ CachingSources := true.
+ ].
OperatingSystem isUNIXlike ifTrue:[
CacheDirectoryName := '~/.smalltalk/sourceCache'.
- ^self
+ ] ifFalse:[
+ CacheDirectoryName := (Filename defaultTempDirectory constructString:'stx_sourceCache').
].
- CacheDirectoryName := (Filename defaultTempDirectory constructString:'stx_sourceCache').
-
-
+
"
self initCacheDirPath
"
@@ -94,7 +97,9 @@
CachingSources isNil ifTrue:[CachingSources := false].
UseWorkTree isNil ifTrue:[UseWorkTree := false].
- self validateCacheDirPath.
+ CachingSources ifTrue:[
+ self validateCacheDirPath.
+ ].
Smalltalk addDependent:self
"Modified: / 02-03-2012 / 17:00:11 / cg"
@@ -118,8 +123,9 @@
!AbstractSourceCodeManager class methodsFor:'accessing'!
availableManagers
- ^ AbstractSourceCodeManager allSubclasses
- reject:[:cls | (cls isAbstract) or:[cls isExperimental ]].
+ ^ AbstractSourceCodeManager
+ allSubclasses
+ reject:[:cls | (cls isAbstract) or:[cls isExperimental ]].
"
self availableManagers
@@ -131,6 +137,11 @@
sources are kept for faster access. The default is '/tmp/stx_sourceCache'.
This cache is shared among all ST/X users on a system."
+ self cachingSources ifTrue:[
+ (CacheDirectoryName isNil) ifTrue:[
+ self initCacheDirPath
+ ].
+ ].
^ CacheDirectoryName
"Modified: 12.9.1996 / 02:20:45 / cg"
@@ -140,8 +151,8 @@
"set the name of the cache directory, where checked out class
sources are kept for faster access. The default is '/tmp/stx_sourceCache'.
This cache is shared among all ST/X users on a system.
- The directory is typically set via the launchers setting menu, or
- from a startup rc-file."
+ The directory is typically set via the launcher's setting menu,
+ or from a startup rc-file."
CacheDirectoryName := aStringOrFilename.
@@ -159,7 +170,7 @@
"return true, if source caching is enabled.
(see cacheDirectoryName for what that means)"
- ^ CachingSources
+ ^ CachingSources ? false
"Created: 16.12.1995 / 15:17:50 / cg"
"Modified: 12.9.1996 / 02:22:19 / cg"
@@ -189,11 +200,10 @@
"If source code management is disabled, return #(). Following code
is hack since there is no global boolean flag, sigh"
- ^(Smalltalk at:#SourceCodeManager) isNil ifTrue:[
- #()
- ] ifFalse:[
- self availableManagers select:[:manager|manager enabled].
- ]
+ (Smalltalk at:#SourceCodeManager) isNil ifTrue:[
+ ^ #()
+ ].
+ ^ self availableManagers select:[:manager | manager enabled].