[Cuis-dev] Do classes know what package they come from ?
Gerald Klix
cuis.01 at klix.ch
Mon Aug 9 06:16:58 PDT 2021
I am inclined to say "no' here ;-}
The package of a class is determined by its category,
to be precise the packages now which classes they
are responsible for.
Please see Object class>>#package and
follow the chain of implementers.
You will end at CodePackage>>#includesClass:
It is possible to subclass CodePackage for
your package and do something entirely different
here, up to messing things up beyond repair.
For your purpose `MySpiffyClass package fullFileName`
should be sufficient.
HTH,
Gerald
On 8/9/21 2:33 PM, Nicola Mingotti via Cuis-dev wrote:
> Hi again,
>
> Problem. I have made my own package, classes, methods.
> Ok, all is ready to start the real work. But I need to do
> some cleaning and put data files in a reasonably safe directory
> Example: some JSON data file needed by my methods.
>
> The ideal for me would be to put the data files in the same directory
> containing the FooBar.pck.st file, or a sub-directory of it.
>
> Now, it would be all easy if i could say
> ----
> FooBar getMyPackageDirectory.
> ----
>
> Up to now i found that
> -----------------
> ou1 _ CodePackageList new. "# here I can find the loaded package list."
>
> Then I could iterate over CodePackage list in 'CodePackageList new
> packages' and check
> the first one containing class 'FooBar'.
>
> What I ask you is this. Can I go in the inverse way? Does
> a Class know who is its ClassCatergory ? Does a ClassCategory
> know who is its package ?
>
>
> bye
> Nicola
>
>
>
More information about the Cuis-dev
mailing list