From 9d66bea9da9ddbaa6f48c392511d51708f8b1073 Mon Sep 17 00:00:00 2001
From: Martin Craig <martin.craig@eng.ox.ac.uk>
Date: Wed, 22 Apr 2020 11:34:50 +0100
Subject: [PATCH] Make error message more accurate in terms of what's actually
 gone wrong The problem here is not that it can't find the folder but that
 FSLDIR suggests a WSL installation but does not match the format required to
 identify the distro folder.

---
 fsl/utils/platform.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fsl/utils/platform.py b/fsl/utils/platform.py
index 8599928e1..173b031cb 100644
--- a/fsl/utils/platform.py
+++ b/fsl/utils/platform.py
@@ -453,10 +453,10 @@ class Platform(notifier.Notifier):
             else:
                 distro = None
 
-            if distro is None:
-                raise RuntimeError("No WSL installations found at \\wsl$\ - a valid WSL 2.0 installation is required")
-            else:
-                return "\\\\wsl$\\" + distro + wslpath.replace("/", "\\")
+            if not distro:
+                raise RuntimeError("Could not identify WSL installation from FSLDIR (%s)" % self.fsldir)
+
+            return "\\\\wsl$\\" + distro + wslpath.replace("/", "\\")
 
 platform = Platform()
 """An instance of the :class:`Platform` class. Feel free to create your own
-- 
GitLab