Author Topic: Changing file path of imported code  (Read 1622 times)

branfornpeter

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Changing file path of imported code
« on: January 03, 2018, 09:07:22 pm »
Hi guys,

after a long time of absence I am trying the latest version of EA (13.5.1352, Build 1352). I am importing code (C++ and python). This works OK if running on windows; running on Wine/Linux this is NOK, but I do not care so much.

My problem 1 is this: After importing code I realized the path to source code is absolute, including "D://...". This is a big issue for me, as I want to share my EAP file and possibly use it on other systems with other paths.
My problem 2 is this: If I start synchronizing the model with code, it does _not_ complain if it does not find a certain file. This is even worse: I did not initiallly realize the paths are absolute until I found out my code changes are not taken over into the model(s).

Note: changing the paths in the "settings" of a model item to a relative one does not work, the code is not found (but again no error message, but the code view will not open).

Is there any way to improve this for me or this "what you get"?

Thanks a lot!

branfornpeter

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Changing file path of imported code
« Reply #1 on: January 03, 2018, 09:16:09 pm »
There seems to be a feature called "local file paths", see this post on stack overflow> https://stackoverflow.com/questions/4974836/enterprise-architect-how-to-synchronize-with-source-code-source-model-when

Text (to persist solution here):



The version I use is 8.0.860

The solution is to use a feature called "Locale Paths" in EA. You find it in the menue item Settings-->Locale Paths... It opens a dialog box that enables you to replace local paths in the model with an ID and vice versa. With this feature it is possible to replace a present path in the model with another one. It also gives you the possibility to use the model on different machines with different local paths.

To find out to which local path a given class in the model was bound I grepped the binary file of the model. Then I replaced the path name with the buttons ApplyPath and ExpandPath. To me it seemed that the changes in the model concerning the path take effect not until closing EA and restarting it again.

After that it was possible to see the source code of a class by right clicking the class and executing "View source code..." at the new location on the disk.


---------
I will test it now.

branfornpeter

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Changing file path of imported code
« Reply #2 on: January 03, 2018, 11:12:01 pm »
Ok, this works with latest version of EA, also. I found the menu item by searching for "local path" in the "Find Command" input field on top of the menu.

Nabil

  • EA User
  • **
  • Posts: 138
  • Karma: +5/-2
  • Customizing EA for you
    • View Profile
    • View My LinkedIn Profile Here
Re: Changing file path of imported code
« Reply #3 on: January 09, 2018, 12:36:48 am »
Hello

you can use this to replace file path

function updateFilePath(curElement)
{
   var curElement as EA.Element;
   if(curElement.Genfile != "")
   {
      curElement.Genfile = "C:\\nabil\\code_generation\\CAN.h";
      curElement.Update();
      Session.Output(curElement.Name +  " : Updated");
   }
   
   
}

as an alternate

Sparx Systems India - Services
Ultimate Guide EA14 | Consulting | Training Plans

juan.drn

  • EA Novice
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
Re: Changing file path of imported code
« Reply #4 on: March 24, 2018, 01:30:27 am »
I had a problem doing it, remplacing from id to path again, the path in generate code window was left as %%C:\Proyectos\svn2\B Planner .Net\trunk\BPlanner%%\SerieChannel.cs, and I cannot replace it, how can I change the path manually

Thanks