Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the path of a jar in libgdx?

I'm creating a desktop application in libgdx and want to get the jar path so I can access a folder next to it. There's a lot of Gdx.files.(insert variable name here) but they are confusing me. Thank you!

like image 402
thetheodor Avatar asked Jan 16 '26 18:01

thetheodor


1 Answers

The Gdx.files has a few different filehandles. Let me explain them:

  1. Gdx.files.Claspath: Path relative to the root of the classpath. Readonly! Not for HTML5 and iOS
  2. Gdx.files.Internal: Path relative to the asset (on Android) or root (on Desktop). Readonly!
  3. Gdx.files.External: Path relativ to the SD Card (on Android) or Home (on Desktop). Not for HTML5
  4. Gdx.files.Local: Path relative to private files (on Android) or Application root (on Desktop). Not for HTML5
  5. Gdx.files.Absolute: A full Path. Not for HTML5.

Sources: FileHandling and Gdx.Files Source

like image 102
Robert P Avatar answered Jan 19 '26 19:01

Robert P



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!