--- a/src/document.cc Fri Dec 20 18:22:24 2013 +0200 +++ b/src/document.cc Sat Dec 21 02:19:32 2013 +0200 @@ -223,6 +223,7 @@ // Try find it relative to other currently open documents. We want a file // in the immediate vicinity of a current model to override stock LDraw stuff. + str reltop = basename (dirname (relpath)); for (LDDocument* doc : g_loadedFiles) { if (doc->getFullPath().isEmpty()) continue; @@ -230,7 +231,17 @@ str partpath = fmt ("%1/%2", dirname (doc->getFullPath()), relpath); if (f->open (partpath, File::Read)) - return f; + { // ensure we don't mix subfiles and 48-primitives with non-subfiles and non-48 + str proptop = basename (dirname (partpath)); + + bool bogus = (proptop == "s" && reltop != "s") || + (proptop == "48" && reltop != "48") || + (reltop == "s" && proptop != "s") || + (reltop == "48" && proptop != "48"); + + if (!bogus) + return f; + } } if (f->open (relpath, File::Read))