I have a function living in a local module, which reads some locally saved files in my package using an path: “src/folder1/…/myfile.txt”. Its purpose is solely to read and return the contents of the file. The problem is that when this function is called somewhere else, say inside of “folder1”, the paths get messed up, because of course “src” doesn’t exist in “folder1”. I’ve looked at similar posts, which talked about @DIR, @MODULE, pathof(), etc, but none of the suggestions solved my problem. Has anyone here run into a similar situation before?
Yeah, the read function should be defined in the same space relative to the file to be read. However I am calling the read function from a different location. I don’t think this solution works if I am not calling the read function in /src.