Author Topic: problems using %packagePath%  (Read 5379 times)

tathata

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
problems using %packagePath%
« on: June 16, 2004, 02:56:46 pm »
I am working on a code generation template for ActionScript 2.0.  Most of my template is working just fine with the exception of the %packagePath%

The packagePath should be outputing "net.test" but instead is only outputting "net"

Here is a snippet of my AS2 file that was generated from my template.
---------------------------------------

class net.MyASClazz
{
     public function MyASClazz()
     {

     };

}; //end MyASClazz

----------------------------------------

The line "class net.MyASClazz" should read "class net.test.MyASClazz"!!

If I try outputting C# code file it outputs the name space just fine!!

Here is the section from my template that should generate the proper name space path (note most of the code was barrowed from the C# template code).

************************
$name = %packagePath%
%if packageIsFirstNonEmpty != "T"%
$name = %packageName%
%endIf%

%if elemType == "Interface"%

%PI=""%
$name = "interface "+$name+"."+%className%
%endTemplate%

%PI=""%
$name = "class "+$name+"."+%className%

$name
***************************

I have been reading documentation and looking at other code generation templates but I just can't get it figured out!  No matter what I have tried %packagePath% only gives me the first package name and drops everything in the middle!

Can someone give me a hand sorting this problem out??

Thanks!!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: problems using %packagePath%
« Reply #1 on: June 17, 2004, 11:19:59 pm »
Hi,

Here's your problem.  The package is only being set at the first level after the root namespace.  This is setting the package to "net".  It is never set after that.

To set the package you need to actually call the Namespace template.  So, instead of having
%list="Class" @separator="\n\n"%
in your file level template use
%list="Namespace" @separator="\n\n"%

Then use
%list="Namespace" @separator="\n\n"%
%list="Class" @separator="\n\n"%
as your namespace template.

That should fix your problem.

Simon
« Last Edit: June 17, 2004, 11:33:59 pm by simonm »

tathata

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: problems using %packagePath%
« Reply #2 on: June 18, 2004, 07:42:57 am »
That fixed it, Thanks!