Cristian Ceron
Cristian Ceron

Reputation: 745

Libgdx file.internal file not found error

I need to use an atlas file in my project. But libgdx only is giving me a file not found error, even when I already have the atlas inside the assets folder.

Here it's the code:

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/gui/GUI.java

  LoadAtlas.addListener(new InputListener()
            {
                @Override
                 public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
                    character.AddAnimation(AtlasName.getText());
                    return true;
            }
            });

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/gui/Chara.java

public void AddAnimation(String s)
    {
        chara_atlas.AddAnimation(s);
    }

https://github.com/cristianceron/CharacterEditor/blob/master/core/src/character/Character_Atlas.java

public void AddAnimation(String name)
    {
        if (Gdx.files.internal(name).exists())
        {
        TextureAtlas tmp = new TextureAtlas(Gdx.files.internal(name));
        texture_atlases.add(tmp);
        animations.add(new Animation(1/15f, texture_atlases.get(texture_atlases.size()-1).getRegions()));
        }
        else
        {
            Gdx.app.log("File", "File Not found " + name);
        }
    }

EDIT: link to my project github repo: https://github.com/cristianceron/CharacterEditor

link to the assets folder: https://github.com/cristianceron/CharacterEditor/tree/master/android/assets

error code: error file not found

Upvotes: 1

Views: 671

Answers (1)

Cristian Ceron
Cristian Ceron

Reputation: 745

Thanks to the IRC guys, my error was using Gdx.files.internal with a variable instead of using Gdx.files.local.

Silly of me.

Upvotes: 2

Related Questions