openframeworks / openframeworks/openFrameworks

Relative ofToDataPath() behavior and expected paths for data items

Open
#5,687 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
10.4k
Forks
2.6k
Avg merge
1d 21h
Merged PRs (30d)
9

Description

Testing this on today's master, I see that ofToDataPath(false) changed behavior.

string myPath = ofToDataPath("test.png", false);
// myPath is "data/test.png", but it used to be (and I think it should) "test.png";

If I remember right, ofToDataPath() used to return the path from "inside" data, so "data/" would not be part of the path. Testing some more, I created a png in data/0.png and to my surprise, both:

ofLoadImage(pix, "0.png");
ofLoadImage(pix, "data/0.png");

load the image!

Is this intentional? If this is supposed to "help out" by being smart about paths that start with "data/", it seems counter-productive... But I wonder what the behavior should be.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the implementation and callers of ofToDataPath(), then compare its handling of "test.png", "0.png", and "data/0.png" with the ofLoadImage() examples in the issue. Clarify the intended path contract first, then add coverage showing the expected results for relative data paths and verify the image-loading behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.