d3cod3 / Mosaic

Mosaic, an openFrameworks based Visual Patching Creative-Coding Platform
https://mosaic.d3cod3.org
Other
421 stars 23 forks source link

Data folder path wrong on osx 10.12 ? #46

Closed Daandelange closed 1 year ago

Daandelange commented 3 years ago

After updating Mosaic from master, ofApp::initDataFolderFromBundle() tries to replace the data folder (~/Documents/Mosaic/data) with a brand new corresponding to the release folder. On my setup, the automatic copy command fails.
Manually copying MosaicRepo/bin/data to ~/Documents/Mosaic/data works, but I'd like the automatic alternative to work.

Here's my diagnostic :

Shouldn't dataDir hold something like MosaicRepo/bin/Mosaic_debug.app/Contents/Resources/../../../data ?
Or should the Resources folder exist ?

I'd also like to implement a datafolder-available-check to prevent Mosaic from running (=crashing later) within initDataFolderFromBundle(). Good idea ?

d3cod3 commented 3 years ago

Yes, what's happening is normal, i'll explain:

in OSX ( and only there ) the MosaicRepo/bin/data/ folder content is the reference of what needs to be copied inside the bundle after compiling ( manually, and just for the first time, as newer compiles on the same path will maintain the bundle content ). It is working like that because until now, most of the time users in OSX just download the release and run it, so no issues with that, but yes, you're right, this need some kind of automation, i'll write a script to run after ( or before ) compile to automatically copy everything inside the bundle, so this scenario will disappear.

But yes, the idea of implementing a datafolder-available-check it's a good one, so let me know when you have it, and thanks for the suggestion!

This is the Mosaic bundle content ( for reference )

Sin título :

with data/ content copied inside Resources/ folder and examples/ and plugins/ folders copied as it is.

sorry for the delay, i was AFK

Daandelange commented 2 years ago

Ok, thanks for your clarification.
I think the Release should be as easy to run as a binary compiled from source (except it takes longer); so yes, please make this scenario disappear 😇 .

https://github.com/d3cod3/Mosaic/tree/fix-dataFolder-issue-46 I got something here for checking the data folder and added some log messages to them. (Note: I also re-arranged some conditions to prevent duplicate code.) There's even a fallback for grabbing it from the CompiledBinary/../data folder (which exists if ran from a MosaicRepos), but it looks at binary/../data so this might be insecure if the ReleaseBinary/../data exists in some rare cases. (possible solution: only include that part in debug builds, or strip it out)

Daandelange commented 1 year ago

I'm looking into this, it has never been fixed and it really bothers me on every version increment. Is there something like a "release" or "git" compile flag in Mosaic ? (not debug/release)

Daandelange commented 1 year ago

That fixes them on OSX :)

Daandelange commented 1 year ago

Closing this as it's been merged. :)