Skip to content

Commit

Permalink
Fix file handle list returning wrong path
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Jul 29, 2024
1 parent af9f041 commit eb6f834
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.xpenatan.gdx.backends.teavm.filesystem;

import com.badlogic.gdx.Files;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.utils.Array;
Expand Down Expand Up @@ -254,6 +255,8 @@ private String[] getAllChildren(FileHandle file) {

private String[] list(FileHandle file, boolean equals) {
String dir = fixPath(file.path());

Files.FileType type = file.type();
boolean isRoot = isRootFolder(file);
if(debug) {
System.out.println("########## START LIST ### isRoot: " + isRoot + " DIR: " + dir);
Expand All @@ -263,7 +266,8 @@ private String[] list(FileHandle file, boolean equals) {
ObjectMap.Entry<String, FileData> next = it.next();
String path = fixPath(next.key);

FileHandle parent = getFilePath(path).parent();
FileHandle pathFileHandle = Gdx.files.getFileHandle(path, type);
FileHandle parent = pathFileHandle.parent();
String parentPath = fixPath(parent.path());

boolean isChildParentRoot = isRootFolder(parent);
Expand Down Expand Up @@ -314,10 +318,6 @@ private String[] list(FileHandle file, boolean equals) {
return str;
}

protected FileHandle getFilePath(String path) {
return Gdx.files.internal(path);
}

protected void putFile(String key, FileData data) {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ private void setupIndexedDB(TeaApplication teaApplication) {
});
}

@Override
protected FileHandle getFilePath(String path) {
return Gdx.files.local(path);
}

@Override
protected void putFile(String key, FileData fileData) {
if(debug) {
Expand Down

0 comments on commit eb6f834

Please sign in to comment.