From f5dfa9affe103277c6dc3f69cd1f4e9721d6895f Mon Sep 17 00:00:00 2001 From: Robert Vokac Date: Mon, 5 Aug 2024 12:56:23 +0200 Subject: [PATCH] Added new class AssetsTxt III --- core/src/main/java/com/openeggbert/main/AssetsTxt.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/openeggbert/main/AssetsTxt.java b/core/src/main/java/com/openeggbert/main/AssetsTxt.java index 1c921c7..2db19a4 100644 --- a/core/src/main/java/com/openeggbert/main/AssetsTxt.java +++ b/core/src/main/java/com/openeggbert/main/AssetsTxt.java @@ -19,6 +19,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////// package com.openeggbert.main; +import com.badlogic.gdx.Application; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; import com.openeggbert.entity.common.OpenEggbertException; @@ -28,6 +29,7 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -154,9 +156,13 @@ public class AssetsTxt { public List list(FileHandle fileHandle) { String pathToDirectory = fileHandle.path();//((fileHandle.path().isEmpty() ? "" : (fileHandle.path() + "/"))) + fileHandle.name(); + Function createFileHandle = s -> + Gdx.app.getType() == Application.ApplicationType.Desktop ? + Gdx.files.classpath(s):Gdx.files.internal(s) + ; return AssetsTxt.this.list(pathToDirectory) .stream() - .map(p-> Gdx.files.classpath((pathToDirectory.equals(".") ? "" : (pathToDirectory + "/")) + p)) + .map(p-> createFileHandle.apply((pathToDirectory.equals(".") ? "" : (pathToDirectory + "/")) + p)) .collect(Collectors.toList()); }