Discover in what package a Class lives

From Cuis CookBook
Jump to navigation Jump to search

Problem. In what package does a class live? In what directory is that? You may well want to know that because, for example, it might be necessary to ship some data with your packages and the easiest solution is probably to put them in the same directory.

Solution. Let's do it with an example. I load the package Sound, to have some external class to study Feature require: 'Sound'. then go looking for the package of the class SoundSystem and its position on the filesystem with:

SoundSystem package.                       "=>  a CodePackage(Sound 1.23) "
SoundSystem package packageDirectoryName . "=> '/home/p/prog/smalltalk/Cuis-Smalltalk-Dev/Packages/Features/' "