public FileName resolveName(final FileName base,
final String name,
final NameScope scope)
throws FileSystemException
{
final FileName realBase;
if (base != null && VFS.isUriStyle() && base.getType() == FileType.FILE)
{
realBase = base.getParent();
}
else
{
realBase = base;
}
final StringBuffer buffer = new StringBuffer(name);
// Adjust separators
UriParser.fixSeparators(buffer);
// Determine whether to prepend the base path
if (name.length() == 0 || name.charAt(0) != FileName.SEPARATOR_CHAR)
{
// Supplied path is not absolute
if (!VFS.isUriStyle())
{
// when using uris the parent already do have the trailing "/"
buffer.insert(0, FileName.SEPARATOR_CHAR);
}
buffer.insert(0, realBase.getPath());
}
//// UriParser.canonicalizePath(buffer, 0, name.length());
// Normalise the path
FileType fileType = UriParser.normalisePath(buffer);
// Check the name is ok
final String resolvedPath = buffer.toString();
if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope))
{
throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name);
}
String scheme = realBase.getScheme();
String fullPath = realBase.getRootURI() + resolvedPath;
final FileProvider provider = (FileProvider) providers.get(scheme);
if (provider != null)
{
// todo: extend the filename parser to be able to parse
// only a pathname and take the missing informations from