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

Relative file path in JOSM session file #6

Open
m93a opened this issue Jun 30, 2024 · 1 comment
Open

Relative file path in JOSM session file #6

m93a opened this issue Jun 30, 2024 · 1 comment

Comments

@m93a
Copy link

m93a commented Jun 30, 2024

In a session.jos file, the other layers can be specified by paths relative to the session file:

<?xml version="1.0" encoding="utf-8"?>
<josm-session version="0.1">
    <layers active="1">
        <layer index="1" name="data_layer.osm" type="osm-data" version="0.1" visible="true">
            <file>./data.osm</file>
        </layer>
        <layer index="2" name="google_contours.osm" type="osm-data" version="0.1" visible="true">
            <file>./contours.osm</file>
        </layer>
    </layers>
</josm-session>

However, if I try to include a pic layer using a relative path:

<layer index="3" name="p69_001.png" type="piclayerImage" version="0.1" visible="true">
    <piclayerImage>
        <file>./my_pic.png</file>
        <thumbnail>false</thumbnail>
    </piclayerImage>
</layer>

I get an error:
image

The only way to get the image to load is by using a full absolute path. This ruins the portability of a session file that would otherwise work across different machines.

@m93a
Copy link
Author

m93a commented Jun 30, 2024

This is probably caused by this line:

entry.setFile(new File(attrElem.getTextContent()));

The file path should be resolved relative to the session file.

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

No branches or pull requests

1 participant