Book a Demo

Author Topic: Include file paths  (Read 5663 times)

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Include file paths
« on: March 04, 2006, 06:13:45 pm »
Hi

I want to generate code in a directory structure corresponding to my model packages. I can get the sources produced in the correct directories, but the file paths for include files are not maintained in the code and I can't see a way to enable or automate this.

Class1 is in the folder above Class2. Class2 is assosciated with Class1 and needs to include the source.

I get require_once ('Class1.inc');

I want require_once ('../Class1.inc');

I'm generating in PHP, so there's no global paths I can set (ala Visual Studio etc.). The paths have to be generated, preferrably selectable as relative or not.

I would also like the option to produce code that replaces a file path with a macro or variable.

Any ideas, or am I being really dumb and missing something fundamental?

Cheers

John
« Last Edit: March 04, 2006, 06:18:39 pm by muso »

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Include file paths
« Reply #1 on: March 07, 2006, 04:40:51 pm »
Hey

Someone must have an idea?  :-[

Cheers

John

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Include file paths
« Reply #2 on: March 07, 2006, 07:24:29 pm »
The only hope for doing it at the moment is by calling an add-in from the import template.

Currently there are only 3 macros available to get information about an import.  (There are others that give information about how it's being imported though.)
  • importPackagePath
  • importClassName
  • importFileName - Only gives the file, noth the path.
An addin could use these to find the original class and return a relative file path.

Well, that's at least until a macro for a relative file path can be added.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Include file paths
« Reply #3 on: March 07, 2006, 08:21:34 pm »
I take it back.

It's possible to do it by defining a local path and using that in a filename like "%Test%\..\Class6.php".  It won't work in general because not all classes will be in the same relative path.

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Include file paths
« Reply #4 on: March 08, 2006, 08:49:26 am »
Hey

Thanks Simon. I'm not sure about the addin. I'll check out the help files.

with the defined local path, how do I get this variable added into the aquto generated code?

Lasly, will I need to raise a new feature request?

This is a very common layout for web sites, and maintenance of files paths is pretty key for file generation, otherwise every file needs to be edited after code gen.

Thanks agin.

Cheers

John

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Include file paths
« Reply #5 on: March 14, 2006, 04:05:04 pm »
boink...

thomaskilian

  • Guest
Re: Include file paths
« Reply #6 on: March 15, 2006, 12:40:56 am »
Have you read Simons 2nd post? Read the Help about Local Paths.

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Include file paths
« Reply #7 on: March 21, 2006, 05:16:43 pm »
Hey

Funnily enough I did read his reply. Did you?

"It won't work in general because not all classes will be in the same relative path."

I could have misunderstood what simonm meant, but is it a crime to ask a follow up question? As far as I can see the helpfiles don't cover this. Sure they cover the local paths dialog, but not this kind of eventuality.

After some experimentation I couldn't get this doing what I need. After reading your reply I tried again. Still no joy.

As you are an EA Guru you probably don't need to ask any questions, but this feature certainly isn't intuitive for newbies.

Cheers

John

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Include file paths
« Reply #8 on: March 22, 2006, 01:46:55 am »
Well, he requested it be downgraded from EA God, so we should all be thankful ;)
Maybe he missed your point ?

thomaskilian

  • Guest
Re: Include file paths
« Reply #9 on: March 22, 2006, 02:24:42 am »
Maybe he should have asked more clearly :-/ OTOH I make mistakes too. This one's obviously too difficult for me.

muso

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Include file paths
« Reply #10 on: March 22, 2006, 05:49:33 am »
Obviously.
>:(

Without getting completely drawn into a protracted debate, it was clear enough for simonm to understand without giving me a hard time, being dismissive or patronising.

If you didn't understand the problem, why point me at the help files for the answer?




thomaskilian

  • Guest
Re: Include file paths
« Reply #11 on: March 22, 2006, 12:28:22 pm »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Include file paths
« Reply #12 on: March 22, 2006, 01:26:44 pm »
Hi Guys,

Sorry, I should have been clearer in my response, and then should have replied earlier.

Initially I said that it wasn't possible to do without an add-in that could use the macros that are available to construct a relative file path.  The use of EXEC_ADD_IN to call an addin from a template is documented here.

Shortly after that post I discovered that when local paths are used the path after the local path identifier is generated as the import.  Local paths are documented here.

This will work well if the classes you are generating are all going to one directory, but with the right setup the includes (or requires for PHP) for the other classes can be generated correctly.

The situation where this won't work is when the class being generated is not in the same directory as the local path.  The relative paths will then be generated as if it was in that directory.

I haven't forgotten this issue, despite my silence.  There has been progress on adding a new macro to the template language to handle this situation.  At the moment I can't say when this will be released.

I hope that this clarifies what is going on.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Include file paths
« Reply #13 on: March 23, 2006, 01:07:33 am »
Quote
If you didn't understand the problem, why point me at the help files for the answer?
The nature of forums - people post information they think will be helpful, sometimes even if they don't necessarily fully understand the request (or maybe they thought they understood but didn't).

No need (ever!) to get  >:( angry - we all give what we can on this forum. You may have interpreted Have you read Simon's 2nd post as patronising, but you'd be surprised at how many (even experienced!) questioners sometimes need a nudge of "RTFM".

I understood that posting to say, "Simon's second post appears to me to deal with what you're asking". So back to you to explain why it doesn't !

Thomas' "guru" status is purely down to his number of postings, a good many of which have consisted of giving useful answers or suggestions to other people's questions, but I don't think he pretends to any superior insights - just good EA experience.

Take what helps, help if you can, ignore anything annoying - it's probably not intentional !