Beispiel #1
0
AnsiString PathUtil::combine(const AnsiString &path1, const AnsiString &path2) {
	AnsiString newPath1 = unifySeparators(path1);
	AnsiString newPath2 = unifySeparators(path2);

	if (!newPath1.hasSuffix("/") && !newPath2.hasPrefix("/")) {
		newPath1 += "/";
	}

	return newPath1 + newPath2;
}
Beispiel #2
0
AnsiString PathUtil::getFileName(const AnsiString &path) {
	AnsiString newPath = unifySeparators(path);
	Common::String lastPart = Common::lastPathComponent(newPath, '/');
	if (lastPart[lastPart.size() - 1 ] != '/') {
		return lastPart;
	} else {
		return path;
	}
}
Beispiel #3
0
void vfs::Path::doCheck()
{
	if(!_path.empty())
	{
		unifySeparators(_path);

		vfs::UInt32 number_of_separators = removeSeparators(_path);

		if(number_of_separators>0)
		{
			removeDots(_path,number_of_separators+1);
			getFirstLastSeparator(_path.c_str(),_sep.first,_sep.last);
		}
	}
}
Beispiel #4
0
AnsiString PathUtil::getDirectoryName(const AnsiString &path) {
	AnsiString newPath = unifySeparators(path);
	Common::String filename = getFileName(path);
	return Common::String(path.c_str(), path.size() - filename.size());
}
Beispiel #5
0
AnsiString PathUtil::normalizeFileName(const AnsiString &path) {
	AnsiString newPath = unifySeparators(path);
	newPath.toLowercase();
	return newPath;
}