summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-08-09 12:39:20 +0100
committerCarl Hetherington <cth@carlh.net>2012-08-09 12:39:20 +0100
commit05feb78839b7bba56974e418f627c510567023d1 (patch)
tree7a59d6418c0f779ce63ffe98cceec30374ea84f9 /src
parent7241e1666f03aaa60fd4ac1a501f3ecccc092068 (diff)
Append a slash to the state directory name before checking to see if a content file starts with it; fixes problems with content files out-of-state-directory whose name starts with the state directory's name.
Diffstat (limited to 'src')
-rw-r--r--src/lib/film.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc
index 259c3a606..29008c38f 100644
--- a/src/lib/film.cc
+++ b/src/lib/film.cc
@@ -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);
}