diff --git a/gameyfin/src/main/frontend/components/general/input/FileTreeView.tsx b/gameyfin/src/main/frontend/components/general/input/FileTreeView.tsx index 102c16c..2f48891 100644 --- a/gameyfin/src/main/frontend/components/general/input/FileTreeView.tsx +++ b/gameyfin/src/main/frontend/components/general/input/FileTreeView.tsx @@ -117,7 +117,7 @@ export default function FileTreeView({onPathChange}: { onPathChange: (file: stri } return ( -
+
)} /> -
{JSON.stringify(flattenedFileTree, null, 2)}
); } diff --git a/gameyfin/src/main/kotlin/de/grimsi/gameyfin/core/filesystem/FilesystemService.kt b/gameyfin/src/main/kotlin/de/grimsi/gameyfin/core/filesystem/FilesystemService.kt index 99517ca..db77c67 100644 --- a/gameyfin/src/main/kotlin/de/grimsi/gameyfin/core/filesystem/FilesystemService.kt +++ b/gameyfin/src/main/kotlin/de/grimsi/gameyfin/core/filesystem/FilesystemService.kt @@ -23,7 +23,7 @@ class FilesystemService { if (path == null || path.isEmpty()) { val roots = FileSystems.getDefault().rootDirectories.toList() - if (roots.size > 1) return roots.map { + if (getHostOperatingSystem() == OperatingSystemType.WINDOWS) return roots.map { FileDto( it.root.toString(), if (it.isDirectory()) FileType.DIRECTORY else FileType.FILE, @@ -31,7 +31,7 @@ class FilesystemService { ) } - // If there is only one root, return its contents + // UNIX file systems only have one root, so return its contents directly return safeReadDirectoryContents(roots.first().toString()) } @@ -66,8 +66,8 @@ class FilesystemService { Path(path).toFile().listFiles() .filter { !it.isHidden } .map { FileDto(it.name, if (it.isDirectory) FileType.DIRECTORY else FileType.FILE, it.hashCode()) } - } catch (e: Exception) { - log.error(e) { "Error reading directory contents of $path" } + } catch (_: Exception) { + log.error { "Error reading directory contents of $path" } emptyList() } }