renamed all .h to .hpp
[supertux.git] / src / file_system.cpp
1 #include <config.h>
2
3 #include "file_system.hpp"
4
5 #include <string>
6
7 namespace FileSystem
8 {
9
10 std::string dirname(const std::string& filename)
11 {
12   std::string::size_type p = filename.find_last_of('/');
13   if(p == std::string::npos)                              
14     return "";
15   
16   return filename.substr(0, p+1);
17 }
18
19 std::string basename(const std::string& filename)
20 {
21   std::string::size_type p = filename.find_last_of('/');
22   if(p == std::string::npos)
23     return filename;
24
25   return filename.substr(p, filename.size()-p);
26 }
27
28 }
29