Thursday, 19 September 2013

Copy an Internal file to an External location in Libgdx

Copy an Internal file to an External location in Libgdx

I'm trying to use these lines of code to copy a master file
data/HighScores.txt to an external location so its readable. Only problem
is, the code I'm using isn't creating the file..
public static void fixFile() {
FileHandle old = Gdx.files.internal("data/HighScores.txt");
System.out.println(new
File(Gdx.files.external("HighScores.txt").path()).getAbsolutePath());
Gdx.files.external("HighScores.txt").delete();
old.copyTo(Gdx.files.external(""));
}
I don't get any errors or anything, the file just doesn't seem to copy over.
Also, when I try and refrence it using
Gdx.files.external("HighScores.txt") It breaks the program or the reader
reads null

No comments:

Post a Comment