(OS X) Exported sketch looks for data folder in the wrong place

After exporting a python sketch, which needed a .png image file, the .app wouldn’t run.

After doing some testing, I realized the bug was that the sketch was looking for the .png file in “/Users/ME/”, instead of “/Users/ME/App.app/Contents/Processing/data/” (the path of the image).

And even after trying to use sketchPath, it still didn’t work since the sketchPath was “/Users/ME/”.

So here’s the question, how do I make the sketch in the .app register the data file in the correct path or at least somewhere inside the .app without me doing it manually?

Thanks!

That is strange.

Can you spell out the structure of your sketch?

Are you running building a sketch pyde file directly inside the users folder, using the user ME home as the sketch folder?

What happens if you create this sketch ~/Documents/PathTest/PathTest.pyde and run it?

def setup():
    size(600,360)
def draw():
    background(128)
    text(sketchPath(), 10, 20)

I am building the sketch in ~/Documents/Processing/test/ ,
and the other ones are built just in ~/Documents/Processing/name/ .
In case 1, everything happened as predicted:


However, in case two, I got a different result!!!
This time, it turns the sketch path into the base directory “/”!!!

UPDATE:
I opened the .app file and went into test.app/Contents/MacOS/ and edited the unix executable, by removing the --exported on line 5.
Screenshot 2019-12-22 10.27.08
I got this:

So these are literally exactly the same sketch contents, with nothing else in the directory, and the literal folder names and file names are:

/Users/ME/Documents/Processing/test/test.pyde
/Users/ME/Documents/Processing/name/name.pyde

is that correct? No other changes at all, and those are the exact paths/files?

The other one is:

/Users/ME/Documents/Processing/Chess/Chess.pyde

“name” is a generalization for all the other sketches, as I use the same format.