--- a/AbstractSourceCodeManager.st Mon Aug 15 12:52:18 2016 +0200
+++ b/AbstractSourceCodeManager.st Mon Aug 15 13:29:37 2016 +0200
@@ -1246,7 +1246,10 @@
directoryFromContainerPath:containerPath forPackage:packageID
"given a full path as in an RCS header,
- extract the directory (i.e. package)."
+ extract the directory (i.e. package) within the module.
+ Notice:
+ for top-level folder-only modules (like exept, smalltalk),
+ an empty string is returned."
|path idx|
@@ -1256,6 +1259,12 @@
"/ these are always UNIX filenames ...
idx := path indexOf:$/.
idx ~~ 0 ifTrue:[
+ "/ be careful: for top-level module descriptions (folders),
+ "/ the directory is empty
+ (path indexOf:$/ startingAt:idx+1) == 0 ifTrue:[
+ "/ there is no directory
+ ^ ''
+ ].
path := path copyFrom:(idx + 1)
].
@@ -1354,7 +1363,7 @@
containerPath isNil ifTrue:[^ nil].
packageID notNil ifTrue:[
- idx := containerPath lastIndexOfSubCollection:(packageID copyReplaceAll:$: with:$/).
+ idx := containerPath indexOfSubCollection:((packageID copyReplaceAll:$: with:$/),'/').
idx ~~ 0 ifTrue:[
^ containerPath copyFrom:idx.
].
@@ -1500,7 +1509,7 @@
"helper: return a classes sourceCodeInfo by extracting its
versionString components."
- |cls packageInfo revInfo actualSourceFileName classFileNameBase
+ |cls clsPackage packageInfo revInfo actualSourceFileName classFileNameBase
newInfo container expectedFileName
directoryFromVersion moduleFromVersion fileNameFromVersion
directoryFromPackage moduleFromPackage repairedPath|
@@ -1527,9 +1536,16 @@
"/ however, it only contains partial information (module:directory:libName).
"/ (but is available even without a source)
"/
- cls name = cls package ifTrue:[
- "/ very special - the top-modules FolderInfo
- newInfo at:#module put:cls package.
+ clsPackage := cls package.
+ "/ hack: fix on-the-fly if corrupted top-module's package (FolderInfo)
+ (clsPackage endsWith:':') ifTrue:[
+ ('SourceCodeManager [warning]: fixing corrupted package identifier: ',clsPackage) infoPrintCR.
+ clsPackage := clsPackage copyButLast asSymbol.
+ cls setPackage:clsPackage.
+ ].
+ cls name = clsPackage ifTrue:[
+ "/ very special - the top-module's FolderInfo
+ newInfo at:#module put:clsPackage.
newInfo at:#directory put:''.
] ifFalse:[
packageInfo := cls packageSourceCodeInfo.