openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

defaultDataPath() can't handle junction correctly (on Windows)

Open Anton-V-K opened this issue 6 years ago • 1 comments

Consider following directories structure:

Project
+-- Debug (contains *.exe)
|    +-- data => Project\data
+-- Release
|    +-- data => Project\data
|
+-- data (contains *.png)

where both Project\Debug\data, and Project\Release\data are "symlinks" (junctions) to Project\data. In such situation it's impossible to load resources (images) from Project\Debug\data or Project\Release\data, because defaultDataPath() builds wrong path. The problem lies in code:

return std::filesystem::canonical(ofFilePath::join(ofFilePath::getCurrentExeDir(),  "data/")).make_preferred().string();

join returns correct path like X:\...\Project\Debug\data/, while boost::filesystem::canonical seems to be trying to expand the path to something like X:\...\Project\Debug\Project\Debug\data, which is completely incorrect. This is a known issue in boost::fs (see https://svn.boost.org/trac10/ticket/10900 and https://svn.boost.org/trac10/ticket/11138), which seems to be fixed at the main branch.

Tested with released version 0.10.1.

Anton-V-K avatar Oct 01 '19 11:10 Anton-V-K

Hello @Anton-V-K can you please check if this issue is still relevant on nightly builds? thank you

dimitre avatar Mar 17 '23 00:03 dimitre