Commit 94e68a61203d30c3c6cbb6de63bd79fdfba82eb1

Thomas de Grivel 2014-03-07T02:04:10

Fix FIND-ASSET picking wrong extension in case of multiple files with same asset type and different extensions.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/find.lisp b/find.lisp
index bd27adf..b67d519 100644
--- a/find.lisp
+++ b/find.lisp
@@ -152,7 +152,11 @@
 
 (defun find-asset (spec &optional class)
   (or #1=(asset-cache-get `(find-asset ,spec ,class))
-      (setf #1# (first (find-assets-from-spec spec class)))))
+      (setf #1# (let ((ext (when-let ((type (pathname-type spec)))
+			     (intern-extension type)))
+		      (assets (find-assets-from-spec spec class)))
+		  (or (find ext assets :key #'asset-source-ext :test #'eq)
+		      (first assets))))))
 
 ;;  Now that we can find an asset from a string spec we can also
 ;;  add some sugar coating to asset methods.