variable to get directory of entry script

Earlier I was trying to have a script obtain the path of the entry script so that I could publish a file in /extensions with the asset manager.  I had to resort to

$assets->publish( dirname(FILE) . '/…/…/extensions/OFC/open-flash-chart.swf' );

which is not pretty.  What I wanted was

$assets->publish(Yii::app()->____ . '/protected/extensions/OFC/open-flash-chart.swf' );

Or is there something better I could do?

What about



$assets->publish(Yii::getPathOfAlias('application.extensions.OFC.open-flash-chart') . '.swf');


That's better.  I'm going with

Yii::getPathOfAlias('application.extensions.OFC').DIRECTORY_SEPARATOR.'open-flash-chart.swf'

Why does Yii use DIRECTORY_SEPARATOR instead of the shorter DS constant?  I know other php softwares that go with the shorter version…

Yeah, we know DS is used fairly often. The reason we don't use it is because other libraries might already define it (as you said). So we leave this to be defined by users. In the core, we stick to DIRECTORY_SEPARATOR.