TD 7.x Application Path

Discussion forum about all things Gupta, OpenText and the community.
TWitte
Germany
Posts: 75
Joined: 06 Nov 2017, 13:07
Location: Unterhaching

TD 7.x Application Path

Post by TWitte » 29 Nov 2021, 07:58

Hi,

I am currently implementing some modules / frameworks for multiple projects and was wondering if there is any way to set the applicationpath by cdk or anything similar.

Afaik the global path is not saved in the files, the application path is.
So every developer has to set the global path to avoid include errors on start or I have to go through every file within every project to set the include paths (over 200 files).
The global path can be different for every project so the configuration gets messy

Looking for some magic here.

Any suggestions?

Thank you
Timo Witte
BPCS Consulting Services

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3473
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD 7.x Application Path

Post by Dave Rabelink » 29 Nov 2021, 08:22

Use batch files to set the paths per project.

https://wiki.tdcommunity.net/index.php? ... batchfiles

We use GIT and Jenkins for version management and continuous builds.
This is a mixed environment having multiple different TD versions and multiple projects per TD version.
Also each GIT branch can have different build actions.

This is all managed by batchfiles which are part of each GIT branch. Developers just use them on the projects which work flawlessly.
To avoid mixup of folders we do not specify any PATH setting on the development systems. We remove them all.
Also paths are never set in the sources (includes without full paths).
Application path setting in TD is empty.
Application image path setting in TD is empty.
Use global search path setting is enabled. The batch files actually set the value of this setting automatically.

The WIKI page contains example batch files which can be enhanced for your needs.

Here an example of one of our enhanced batch files which does a lot more:

OpenWithTD74.zip

- Use of NuGet. It checks if the system has NuGet installed
- Checks the expected TD version against the installed version (NuGet packages)
- Checks if all needed NUGet packages for development are installed
- Checks if all needed folders are present
- Checks if a build of the project is present
- Removes SQL.ini file path. Our sql.ini is present in the runtime folder.
- Calls another separate batch to install TD IDE user tools automatically (eg code enhancement CDK tools etc)

This file is specific for our needs in a specific project so probably not usable for other projects.
But it shows that using a batch script can setup and check the system in different ways.

In our case it is just cloning a GIT project locally, switch to any branch and run the NuGet package installer inside the branch once and double click on the batch file in the project.
Without any tweaking or changing local PATHS a developer can work on the project immediately and can easily switch between branches/repo's without bothering about the specific needs for those projects.
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

TWitte
Germany
Posts: 75
Joined: 06 Nov 2017, 13:07
Location: Unterhaching

Re: TD 7.x Application Path

Post by TWitte » 29 Nov 2021, 09:10

First of all: Thank you.
This is quite impressive. I will check if this is applicable for us.

What first comes to my mind is, how would I deal with multiple projects opened on the same time? Quite common for us.
Timo Witte
BPCS Consulting Services

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3473
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: TD 7.x Application Path

Post by Dave Rabelink » 29 Nov 2021, 09:21

TWitte wrote:
29 Nov 2021, 09:10
What first comes to my mind is, how would I deal with multiple projects opened on the same time? Quite common for us.
Well, you have to be aware that the PATHS set in the batch file are only for the session (one instance of the running batch file).
So the settings are only for the started TD IDE and do not touch the system or user PATH settings of the workstation.

So you could have a batch file for project 1 (TD 6.1) and a batch file for project 2 (TD 7.4).
You can start these batchfiles independently. So running both TD IDE's at the same time will not interfere with each other.
(the PATH settings done the batches are not known to each other).

The only thing to remember is that the global path settings of TD itself, so the settings in Preferences, are shared between all TD instances of the same TD version.
(because this is stored in the registry).

So if you have multiple projects on the same TD version, each batch file could have different project settings which are read from the registry.

Initially this will not be a problem. You can open for instance a project 1 (TD 7.4.0) and a project (TD 7.4.1) having different global paths.
(the registry setting is read upon loading a TD IDE instance).
But the last started batch file will set the registry and could change the previous set registry setting.

This can be circumvented by using the batch file again to open a new TD IDE instance for the project you want to work on.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

TWitte
Germany
Posts: 75
Joined: 06 Nov 2017, 13:07
Location: Unterhaching

Re: TD 7.x Application Path

Post by TWitte » 29 Nov 2021, 11:28

THIMC:

I just played around a bit and managed to open a td file with doubleclick and open it with preloading the depending batch.
This will only work if you don't have assigned the fileendings to TD by the setup. If so, you need to remove the assignment beforehand.

I assigned the app/apl/apt file endings to a batch file which searches for the "OpenWithTD.bat" from the double clicked file, upwards in the folder structure.

With admin rights execute the follwing commands:
This will assign the filetypes to a class called AppFile
AppFile will be assigned to execute a batchfile, with the parameter %1 which will be the full qualified path to the file you double clicked on.
You also can use a environment variable if you need / want to. ( ftype AppFile="%TDEXECUTE%" --remote-silent "%1" )

Code: Select all

assoc .app=AppFile
assoc .apl=AppFile
assoc .apt=AppFile
ftype AppFile="C:\FindBatchToOpen.bat" --remote-silent "%1"
No admin rights needed from now on.

This is the code of the "C:\FindBatchToOpen.bat"
It will search folder per folder for the "OpenWithTD.bat" file and execute it. So you will be in the context of your project and the dependecies needed.

Code: Select all

@ECHO OFF
SETLOCAL
set "pfile=%2"
set "dir=%~dp2"

:char
set dir=%dir:~0,-1%
IF "%dir:~-1%"=="\" ( goto check ) else ( goto char )
:check
IF EXIST "%dir%\OpenWithTD.bat" ( goto openfile ) else ( goto char )
:openfile
start "TD" %dir%\OpenWithTD.bat %pfile%
:end

GOTO :EOF
Timo Witte
BPCS Consulting Services

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests