Ejemplo n.º 1
0
	void strip(const std::string& bundlePath)
	{
		Poco::File f(bundlePath);
		if (f.isDirectory())
			stripDirectory(bundlePath);
		else if (f.isFile())
			stripFile(bundlePath);
	}
Ejemplo n.º 2
0
SmallImage::SmallImage(string fileName)
{
    mImage = imread(fileName);
    if (mImage.empty()) {
        throw * (new CannotOpenImageException(fileName));
    }
    mName = stripExtension(stripDirectory(fileName));
}
Ejemplo n.º 3
0
std::string FileSystem::stripDirectory(const std::string& path)
{
    if (pathHasDrive(path))     // check for Windows drive
        return stripDirectory(pathWithoutDrive(path));
    else
    {
        size_t last_slash = path.find_last_of("/");
        if (last_slash == std::string::npos)    // No slash
            return path;
        else if (last_slash == path.size() - 1) // Trailing slash
            if (path.size() == 1)
                return "/";
            else
                return stripDirectory(path.substr(0, path.size() - 1));
        else
            return path.substr(last_slash + 1, std::string::npos);
        return "";
    }
}