/[svn]/linuxsampler/trunk/src/common/File.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/common/File.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1781 by iliev, Mon Sep 29 18:21:21 2008 UTC revision 1782 by iliev, Tue Sep 30 02:16:41 2008 UTC
# Line 169  namespace LinuxSampler { Line 169  namespace LinuxSampler {
169          return 0;          return 0;
170      };      };
171  #endif  #endif
         std::string File::basename(std::string path) {  
                 size_t begin = 0;  
                 size_t end = path.length();  
                   
                 for(size_t i=0; i<path.length(); ++i){  
                         if(path[i] == File::DirSeparator) begin = i+1;  
                 }  
                 return path.substr(begin, end).c_str();  
         }  
           
         std::string File::basename(std::string path, std::string sep) {  
                 std::string tmp = File::basename(path);  
                 if(sep.empty())  
                         sep = ".";  
                 size_t begin = 0;  
                 size_t end = tmp.length();  
                 size_t lastdot = tmp.find_last_of(sep)-1;  
                 if(lastdot > 0)  
                         end = lastdot;  
                 return tmp.substr(begin, end).c_str();  
         }  
172  }  }

Legend:
Removed from v.1781  
changed lines
  Added in v.1782

  ViewVC Help
Powered by ViewVC