public override File moveTo(File to)
{
if (isDir() != to.isDir())
{
if (isDir())
throw ArgErr.make("moveTo must be dir `" + to + "`").val;
else
throw ArgErr.make("moveTo must not be dir `" + to + "`").val;
}
if (!(to is LocalFile))
throw IOErr.make("Cannot move LocalFile to " + to.@typeof()).val;
LocalFile dest = (LocalFile)to;
if (dest.exists())
throw IOErr.make("moveTo already exists: " + to).val;
try
{
if (m_file is FileInfo)
(m_file as FileInfo).MoveTo((dest.m_file as FileInfo).FullName);
else
(m_file as DirectoryInfo).MoveTo((dest.m_file as DirectoryInfo).FullName);
}
catch (System.IO.IOException)
{
throw IOErr.make("moveTo failed: " + to).val;
}
return to;
}