Added FileSystem::join("dir", "file") -> "dir/file"
[supertux.git] / src / util / file_system.cpp
index a89b1b4..524d4a5 100644 (file)
@@ -103,6 +103,22 @@ std::string normalize(const std::string& filename)
   return result.str();
 }
 
+std::string join(const std::string& lhs, const std::string& rhs)
+{
+  if (lhs.empty())
+  {
+    return rhs;
+  }
+  else if (lhs.back() == '/')
+  {
+    return lhs + rhs;
+  }
+  else
+  {
+    return lhs + "/" + rhs;
+  }
+}
+
 } // namespace FileSystem
 
 /* EOF */