From 1f28b3a6a7bcdaa9251339f563bfc10cbb373cf7 Mon Sep 17 00:00:00 2001 From: artdeell Date: Sat, 28 Jan 2023 07:57:11 +0300 Subject: [PATCH] Fix the FolderProvider findDocumentPath implementation to make paths actually visible --- .../src/main/assets/components/lwjgl3/version | 2 +- .../net/kdt/pojavlaunch/scoped/FolderProvider.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app_pojavlauncher/src/main/assets/components/lwjgl3/version b/app_pojavlauncher/src/main/assets/components/lwjgl3/version index 18b03e5b5..e9907d8f1 100644 --- a/app_pojavlauncher/src/main/assets/components/lwjgl3/version +++ b/app_pojavlauncher/src/main/assets/components/lwjgl3/version @@ -1 +1 @@ -1665886806915 \ No newline at end of file +1674881685730 \ No newline at end of file diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java index 833366df6..695968384 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/scoped/FolderProvider.java @@ -313,6 +313,15 @@ public class FolderProvider extends DocumentsProvider { public DocumentsContract.Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException { File source = BASE_DIR; if(parentDocumentId != null) source = getFileForDocId(parentDocumentId); - return new DocumentsContract.Path(getDocIdForFile(source), Collections.singletonList(childDocumentId)); + File destination = getFileForDocId(childDocumentId); + List pathIds = new ArrayList<>(); + while(!source.equals(destination) && destination != null) { + pathIds.add(getDocIdForFile(destination)); + destination = destination.getParentFile(); + } + pathIds.add(getDocIdForFile(source)); + Collections.reverse(pathIds); + Log.i("FolderProvider", pathIds.toString()); + return new DocumentsContract.Path(getDocIdForFile(source), pathIds); } } \ No newline at end of file