Class.st
changeset 12018 a24a9968fdf4
parent 12015 ef268a5a3c04
child 12020 bf2165daff68
--- a/Class.st	Wed Sep 23 18:53:05 2009 +0200
+++ b/Class.st	Wed Sep 23 20:04:30 2009 +0200
@@ -700,6 +700,33 @@
     "Created: / 12-10-2006 / 15:49:32 / cg"
 !
 
+
+classFilename
+    "return the name of the file from which the class was compiled.
+     If the class was loaded via an explicit load (i.e. from the fileBrowser),
+     this will be an absolute path. Oherwise, it will be a basename only.
+     See classBaseFilename for a method which always returns the basename."
+
+    |owner info fn|
+
+    (owner := self owningClass) notNil ifTrue:[^ owner classFilename].
+    classFilename notNil ifTrue:[ ^ classFilename ].
+
+    (info := self revisionInfo) notNil ifTrue:[
+        fn := info fileName.
+        fn notNil ifTrue:[
+            ^ fn
+        ].
+    ].
+    ^ (Smalltalk fileNameForClass:self), '.st'
+
+    "
+     Math::ClosedInterval classFilename
+    "
+
+    "Modified: / 22-10-2008 / 20:58:21 / cg"
+!
+
 classPool
     "return something which allows access to my classVariables via
      #at: and #at:put: messages."
@@ -4942,5 +4969,5 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.546 2009-09-23 16:38:46 fm Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.547 2009-09-23 18:04:30 cg Exp $'
 ! !