- now recognizes the recently added 8\ subdirectory

Mon, 23 Dec 2013 11:48:55 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 23 Dec 2013 11:48:55 +0200
changeset 588
720f7480c6b7
parent 587
507e5d5c348c
child 589
1417828920e6

- now recognizes the recently added 8\ subdirectory

changelog.txt file | annotate | diff | comparison | revisions
src/document.cc file | annotate | diff | comparison | revisions
--- a/changelog.txt	Mon Dec 23 10:57:54 2013 +0200
+++ b/changelog.txt	Mon Dec 23 11:48:55 2013 +0200
@@ -30,6 +30,7 @@
 - Upon first start the configuration prompt pops up on its own, defaulting on the profile tab. This
 	way the user can fill in the profile data on the first start and get that out of the way (and
 	gives the opportunity to see the other config fields)
+- Now recognizes "8\" as a special subdirectory alongside "48\" and "s\"
 - Added new action "Add History Line" for quickly inserting 0 !HISTORY lines to headers
 - Added new action "Go to line", default shortcut Ctrl-G. It should be obvious what it does.
 - Added new actions "Hide" and "Reveal" which allow direct setting of objects' visibility setting instead of
--- 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