Leandro Temperoni
Leandro Temperoni

Reputation: 435

Where does Gdx search when i use Gdx.files.local(path)?

I'm using libgdx for a game. I want to read/write text files to update highscores, very simple. I have three files already created placed in "$ANDROID-PROJECT/assets/data" , but Gdx seems to not find them when i use Gdx.files.local("data/file.txt"), but it does when i use Gdx.files.internal("data/file.txt"). Because i need to also write the file, i'm forced to use Gdx.files.local.

Can anyone tell me Where does Gdx search when i use Gdx.files.local(path) ? what path should i specify ?

code:

//for read
FileHandle file = Gdx.files.local("data/scoresCla.txt");

clasico = Float.parseFloat(file.readString());

//for write
FileHandle file = Gdx.files.local("data/scoresCla.txt");

file.writeString(String.valueOf(res), false);

Upvotes: 1

Views: 882

Answers (1)

Leandro Temperoni
Leandro Temperoni

Reputation: 435

if anybody have this problem, i solved by changing Gdx.files.local for Gdx.files.external. This way the files are stored in the SD Card, it has the same functionality of R/W files as local but in the SD Card.

Upvotes: 1

Related Questions