Append a slash to the state directory name before checking to see if a content file...
authorCarl Hetherington <cth@carlh.net>
Thu, 9 Aug 2012 11:39:20 +0000 (12:39 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 9 Aug 2012 11:39:20 +0000 (12:39 +0100)
src/lib/film.cc

index 259c3a60662ec259086a42cc98c267eef83dfc0d..29008c38f565ea0c5b7eda896e18d993821edcb9 100644 (file)
@@ -165,7 +165,16 @@ Film::set_name (string n)
 void
 Film::set_content (string c)
 {
-       if (filesystem::path(c).has_root_directory () && starts_with (c, _state.directory)) {
+       string check = _state.directory;
+
+       filesystem::path slash ("/");
+       string platform_slash = slash.make_preferred().native ();
+
+       if (!ends_with (check, platform_slash)) {
+               check += platform_slash;
+       }
+       
+       if (filesystem::path(c).has_root_directory () && starts_with (c, check)) {
                c = c.substr (_state.directory.length() + 1);
        }