Skip to content

Commit

Permalink
checkPermissions: check result of listFiles()
Browse files Browse the repository at this point in the history
I think this must always be an io error, just log it instead of giving a more cryptic stacktrace
  • Loading branch information
Adam- committed Oct 30, 2024
1 parent 5ae778b commit c22962d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main/java/net/runelite/launcher/FilesystemPermissions.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,20 @@ private static boolean checkPermissions(File tree, boolean root)
// Traverse only the top level directories, and limit the number of files checked,
// to keep it speedy. The primary files which prevent the launcher and client from
// working are all here (repository2, cache, logs, profiles2).
File[] files = tree.listFiles();
if (files == null)
{
log.error("Unable to list files in directory {} (IO error, or is not a directory)", tree);
return false;
}

boolean ok = true;
int numFiles = 0;
for (File file : tree.listFiles())
for (File file : files)
{
if (file.isDirectory())
{
log.debug("Checking permissions of directory {}", file);
if (root && !checkPermissions(file, false))
{
ok = false;
Expand Down

0 comments on commit c22962d

Please sign in to comment.