Open janrenz opened 7 years ago
Hi @jprberlin! So it turns out that we can't guarantee a consistent working directory for packaged apps, especially between operating systems.
The recommendation for finding files that are within your package is to look for them relative to your source files:
# From some Ruby file in your project
file_to_read = File.read(File.join(__FILE__, "../other/file.rb"))
Images will automatically work relative to your application root by themselves when used with the Shoes image
method, but other file types you'll need to handle yourself relatively. Does that make sense?
If i package an app (tested under Mac OS) and i try to load some files that are part of the jar this files. Some debugging later i found out that the working Dir of the app is '/'
Dir.getwd printed '/', and this is not within the jars sandbox or so: Debugging alert:
So how can i load files packaged in the jar with ruby. @PragTob Mabybe you can help you old teacher :)