Preface
This relates directly to Enterprise Architect's API and its scripting capabilities and not so much with actual JScript/Javascript.
Question
How do you obtain the Local Project Path
directory in the project's Version Control Settings
using EA's scripting API?
Note: [Package].XMLPath
only provides the path relative to that location, which is unusable in my situation.
Background
Attempting to create script that adds all packages in an EA project to our version control software (MKS/PTC Integrity) using EA's generic SCC version control setup and scripting capabilities.
I have set up the version control and linked it to a local project for our VC software and am able to use the built-in functionality just fine.
Why the easy solution won't work
First off, I know that EA has an Add Branch to Version Control
option. However, when checking in files to our VC, if the folders in filepath don’t exist in the local project directory (sandbox), our VC will create directories instead of subprojects (different types of containers, long story short: we need subprojects).
I can't use the location of the EAP file as a reference path because that won't be in the local project directory (we're using a singled centralized file on a server).
What I'm Currently Trying
- mkdir folders into local project directory for each package (working)
- Create all subdirectories in our VC (working)
- Use EA's
package.VersionControlAdd
method to add the XML files to that directory in the local project directory (not working!)
!! Step 3 is the problem. !! Here's where the question comes into play. I can't provide the path I want the XML file because I need the local project path
.
I can't find anything referenced in EA's built in help regarding retrieving this information.
Simply look into the text file
The values you are looking for are stored in this file. There is no API. It's EA...
There's a solution to get local version control configuration from within EA scripting (or any other VBscript/VBA environment with appropriate references set). Following there's my helper class to do that; currently it's limited to single VC configuration (I didn't need more and I was in a hurry...). Note there is "Msxml2.DOMDocument.6.0" needed for parsing the XML; change the version appropriately to fit your environment.
Regarging thomas Killian hint: here is a good approach- C# code for what you asked
Access the paths.txt file in the %appdata% folder