Project

General

Profile

Actions

Support Request #6135

closed

Plugin description generator working directory

Added by hidden about 5 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Customer:
BOSCH
Department:
Requester's Priority:
Normal
Support Level:
2nd Level
Resolution:
Solved Issue
Affected Products:
Platform:
Windows 7 64bit
Topic:
ADTF::PluginDescription
FAQ Links:

Description

Support Anfrage:

I have a question about the plugin description generator.

- Currently I use the ADTF3 CMake macros to generate a _pdgen project next to my actual project.
- I am accessing files from my code, relative to the project directory.
- These files are found by my plugin during normal run with the adtf_launcher.
- When I try to generate the plugin description however for my plugin, the plugin description generator is called by my _pdgen project from another directory, and does not find my files, gives a runtime error and the plugin description file is not generated.

Currently I have to do the following to be able to generate my plugin description file:
1. Change all the paths to absolute paths in my plugin source code.
2. Build the plugin.
3. Build the plugin description file.
4. Change back the paths to relative paths.
5. Build the plugin again.

Is there a way to tell the plugin description generator from the ADTF3 CMake macros to run from a specified directory to find my files?
Or is there a way to define the paths for my files in my plugin source code in a way that both the laucher and the plugin description generator is able to find my files?

Thank you for your help!

Lösung:

Use absolute paths based on ADTF Macros instead of relative paths.
Additionally, a product ticket (ACORE-9883) has been opened to evaluate if specifying the Plugin Description Generators working directory is feasible.

Actions #1

Updated by hidden about 5 years ago

  • Project changed from Public Support to 5
  • Status changed from New to In Progress
  • Topic set to ADTF::PluginDescription
Actions #2

Updated by hidden about 5 years ago

  • Product Issue Numbers set to https://www.cip.audi.de/jira/browse/ACORE-9883

Hi Gergő,

Thanks for your feedback!

Changing the Plugin Description Generator's working directory is currently not supported.
I have opened a change issue to provide a way of specifying the WD.
The change - if accepted - will land with the upcoming ADTF 3.5 release.

In the mean time I will look into a way that allows you to work around the issue more comfortably.
From the top of my head I suggest you specify the file paths relative to one of the macros provided by ADTF,
particularly $(ADTF_DIR) and $(ADTF_SESSION_DIR).

You can read up on ADTF macros and how to resolve them in the docs at https://support.digitalwerk.net/adtf/v3/adtf_html/page_adtf_macros.html.

Please let me know if this works for you.

- Wolfgang

Actions #3

Updated by hidden about 5 years ago

  • Status changed from In Progress to Customer Feedback Required
Actions #4

Updated by hidden about 5 years ago

Hi Wolfgang,

thank you for your answer.

I am trying to run the Macro Resolver from my code, but does not seem to work:

cString sessionDir = adtf::services::ant::adtf_resolve_macros(adtf::services::macro::ADTF_SESSION_DIR);

The value of sessionDir is always just "ADTF_SESSION_DIR", both run from plugin description generator and adtf launcher.
I tried to resolve it from both the constructor and the Configure function, neither of them work.

Am I doing something wrong?

Thank you for your help!

Actions #5

Updated by hidden about 5 years ago

Hi Gergő,

You're almost there - does the following snippet work for you?

const tChar* filePath = "$(ADTF_DIR)/path/to/some_file.png";
cString resolvedFilePath = adtf::services::ant::adtf_resolve_macros(filePath);

You mentioned that your plugin loads files relative to the session directory.
While I don't know your use-case I find it odd that a plugin would require files belonging to a session.
The thing is: there is no concept of a session (i.e. *.adtfsession) in the context of the Plugin Description Generator (PDGen)

Would it be possible to load the required files from a location relative to the .adtfplugin or $(ADTF_DIR)?

If the plugin does indeed load files belonging to a specific session, I suggest to load the files as late and lazily as possible.

Regarding the feature request for specifying the working directory (WD):

We can provide an option to set the PDGen's WD with a caveat:
Due to a limitation in CMake < 3.13 there is no obvious way of specifying the WD depending on the configuration (Debug, Release, ...).
This prevents us from setting the WD to the obvious default which is $(ADTF_DIR)/bin and $(ADTF_DIR)/bin/debug respectively.

We will evaluate whether bumping the CMake dependency to 3.13 is an option.

That being said, I believe a macro-based solution fits your use-case best.

- Wolfgang

Actions #6

Updated by hidden about 5 years ago

Hi Wolfgang,

yes, this code works for me. :)

We have a folder for all the configuration files (json files, pictures, etc.) in each ADTF project, that all of the plugins use present is our sessions to access these config files.
This is why (although not ideal) ADTF_SESSION_DIR would be currently the best solution for us to access this folder.

Thank you for your help, I think we will stick with the macro based solution for now.

Actions #7

Updated by hidden about 5 years ago

  • Description updated (diff)
  • Status changed from Customer Feedback Required to To Be Closed
  • Resolution set to Solved Issue
Actions #8

Updated by hidden about 5 years ago

  • Description updated (diff)
Actions #9

Updated by hidden about 5 years ago

  • Project changed from 5 to Public Support
  • Status changed from To Be Closed to Closed
  • Private changed from Yes to No
Actions

Also available in: Atom PDF