// This file is part of Penn TotalRecall <http://memory.psych.upenn.edu/TotalRecall>.
//
// TotalRecall is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 3 only.
//
// TotalRecall is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with TotalRecall. If not, see <http://www.gnu.org/licenses/>.
package util;
/**
* Collection of static methods on file system paths, a la Python's os.path
*
* @author Yuvi Masory
*/
public class OSPath {
/**
* Private constructor to prevent instantiation.
*/
private OSPath() {
}
/**
* Finds the basename of a path, defined as the path without its final dots and any follow characters
*
* @param path Input path
* @return The input path with the extension deleted
*/
public static String basename(String path) {
int i = path.lastIndexOf(".");
if(i > 0) {
return path.substring(0, i);
}
return path;
}
}