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

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

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

revision 1781 by senoner, Mon Dec 3 18:30:47 2007 UTC revision 1782 by iliev, Tue Sep 30 02:16:41 2008 UTC
# Line 243  Path Path::fromWindows(std::string path) Line 243  Path Path::fromWindows(std::string path)
243      return result;      return result;
244  }  }
245    
246    std::string Path::getName(std::string path) {
247        Path p;
248        #if WIN32
249        p.fromWindows(path);
250        #else
251        p.fromPosix(path);
252        #endif
253        
254        return p.getName();
255    }
256    
257    std::string Path::getName() {
258        if(elements.empty()) return "";
259        return elements[elements.size() - 1];
260    }
261    
262    std::string Path::getBaseName(std::string path) {
263         Path p;
264        #if WIN32
265        p = fromWindows(path);
266        #else
267        p = fromPosix(path);
268        #endif
269        
270        return p.getBaseName();
271    }
272    
273    std::string Path::getBaseName() {
274        std::string name = getName();
275        size_t lastdot = name.find_last_of('.');
276        if(lastdot == std::string::npos) return name;
277        return name.substr(0, lastdot);
278    }
279    
280  } // namespace LinuxSampler  } // namespace LinuxSampler

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

  ViewVC Help
Powered by ViewVC