Fix NNUE detection for absolute paths
authorFabian Fichter <ianfab@users.noreply.github.com>
Sun, 15 Nov 2020 13:26:46 +0000 (14:26 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sun, 15 Nov 2020 13:26:46 +0000 (14:26 +0100)
Check the file name, not the full path, for prefix with the variant name.

src/evaluate.cpp

index 2b6f814..4bb3c29 100644 (file)
@@ -88,11 +88,14 @@ namespace Eval {
     constexpr char SepChar = ';';
 #endif
     while (getline(ss, eval_file, SepChar))
-        if (eval_file.rfind(variant, 0) != string::npos || (variant == "chess" && eval_file.rfind("nn-", 0) != string::npos))
+    {
+        string basename = eval_file.substr(eval_file.find_last_of("\\/") + 1);
+        if (basename.rfind(variant, 0) != string::npos || (variant == "chess" && basename.rfind("nn-", 0) != string::npos))
         {
             useNNUE = true;
             break;
         }
+    }
     if (!useNNUE)
         return;