src/document.cc

changeset 588
720f7480c6b7
parent 583
4906c5c1670f
child 590
7aec744ce97b
--- a/src/document.cc	Mon Dec 23 10:57:54 2013 +0200
+++ b/src/document.cc	Mon Dec 23 11:48:55 2013 +0200
@@ -43,6 +43,8 @@
 
 LDDocument* LDDocument::m_curdoc = null;
 
+const QStringList g_specialSubdirectories ({ "s", "48", "8" });
+
 // =============================================================================
 // -----------------------------------------------------------------------------
 namespace LDPaths
@@ -226,10 +228,14 @@
 		{	// 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");
+			bool bogus = false;
+
+			for (str s : g_specialSubdirectories)
+			{	if ((proptop == s && reltop != s) || (reltop == s && proptop != s))
+				{	bogus = true;
+					break;
+				}
+			}
 
 			if (!bogus)
 				return f;
@@ -610,8 +616,7 @@
 		return false;
 
 	// If the second object in the list holds the file name, update that now.
-	// Only do this if the file is explicitly open. If it's saved into a directory
-	// called "s" or "48", prepend that into the name.
+	// Only do this if the file is explicitly open.
 	LDComment* fpathComment = null;
 	LDObject* first = getObject (1);
 
@@ -1224,7 +1229,7 @@
 {	str shortname = basename (a);
 	str topdirname = basename (dirname (a));
 
-	if (topdirname == "s" || topdirname == "48")
+	if (g_specialSubdirectories.contains (topdirname))
 		shortname.prepend (topdirname + "\\");
 
 	return shortname;

mercurial