Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File path is formatted incorrectly #93

Closed
Anokhi1994 opened this issue Oct 8, 2021 · 5 comments
Closed

File path is formatted incorrectly #93

Anokhi1994 opened this issue Oct 8, 2021 · 5 comments
Labels

Comments

@Anokhi1994
Copy link

Anokhi1994 commented Oct 8, 2021

We have a small issue when the ua-model-compiler tries to find the required .csv file.
I work with @Pro on ua-model-compiler.

Problem:
In the file https://github.com/OPCFoundation/UA-ModelCompiler/blob/0b660e9a8ff2e68098f1e846154e880b69f0b0fe/ModelCompiler/ModelDesignerValidator.cs
In the method LoadIncludedDesignFile:

If the 

designFileName is ../deps/DI/OpcUaDiModel

Then

(refer) designFilePath = ../deps/DI/OpcUaDiModel.xml

(refer) identifiersFileName = ../deps/DI/OpcUaDiModel.csv

(refer) identifiersFilePath = Path.Combine(Path.GetDirectoryName("../deps/DI/OpcUaDiModel.xml"), "../deps/DI/OpcUaDiModel.csv");

(refer) identifiersFilePath = Path.Combine("../deps/DI", "../deps/DI/OpcUaDiModel.csv");

Now the identifierFilePath looks like this:
identifiersFilePath = "../deps/DI/../deps/DI/OpcUaDiModel.csv" -> "../deps/deps/DI/OpcUaDiModel.csv"

The .csv is searched in this path.
identifiersFilePath = "../deps/DI/../deps/DI/OpcUaDiModel.csv/../deps/DI/OpcUaDiModel.csv"

What is the error?
We set the FilePath here : https://github.com/opcua-skills/plug-and-produce/blob/master/robot/universal-robots/opcua/universalRobotsModel.xml#L24
And as you see that FilePath is relative: FilePath="../deps/common/deps/robotics_cs/deps/vdma_robotics/OpcUaRoboticsModel"

Why it happens?
The source code was changed that formats the identifierFilePath in an undesired way. Please see the diff:
97617ed#diff-38638fa1be6837b60bf9468dbb641a52cfc3a28d20e025724577c5d7d4725d0fR433

It worked with the old version before the change since string identifiersFilePath = identifiersFileName; We just used the relative FilePath directly (changing .xml to .csv)

Now the path is always combined in a wrong way via:
var identifiersFilePath = Path.Combine(Path.GetDirectoryName(designFilePath), identifiersFileName); (reference)

A quick fix:
We just created a symlink of deps in deps. This is a workaround for now, but of course not very clean and quite messy.

We hope you can fix this for us, it will be really helpful.

@opcfoundation-org
Copy link
Contributor

Change was needed to maintain multiple versions of the same specification/design file.
A common CSV ensures updates always use the same NodeId if new Nodes are added.

Fixed the logic to fall back to the old behavior if no file is found at the new location.
Should be merged to public repo in the next couple days.

@opcfoundation-org
Copy link
Contributor

Fix merged.

@Anokhi1994
Copy link
Author

Thank you so much for fixing it.
I could not find any pull requests where the logic is modified to fall back to the old behavior.
Is it already on master now?

I think some of the files changed and I cannot find the changes for the issue. Could you point to the commit or the diff, it would be helpful.

Thank you so much.

@opcfoundation-org
Copy link
Contributor

Changes got obscured by a directory name change.
a74113d#r57806501

@opcfoundation-org
Copy link
Contributor

No response from poster.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants