private static bool MustCopyFoldersAndFiles(string oldFolderForProjects, string newFolderForProjects)
{
List<string> driveMounts = GetDriveMountList();
var oldPath = oldFolderForProjects;
if (!Path.IsPathRooted(oldPath))
{
try { oldPath = Path.GetFullPath(oldPath); }
catch { return true; } // better safe than sorry if we can't tell the drives
}
var newPath = newFolderForProjects;
if (!Path.IsPathRooted(newPath))
{
try { newPath = Path.GetFullPath(newPath); }
catch { return true; }
}
string oldRoot = null;
string newRoot = null;
if (!MiscUtils.IsUnix)
{
oldPath = oldPath.ToLowerInvariant();
newPath = newPath.ToLowerInvariant();
}
for (var i = 0; i < driveMounts.Count; ++i)
{
var mount = driveMounts[i];
if (oldRoot == null && oldPath.StartsWith(mount))
oldRoot = mount;
if (newRoot == null && newPath.StartsWith(mount))
newRoot = mount;
if (oldRoot != null && newRoot != null)
return oldRoot != newRoot;
}
return true; // shouldn't ever get here, but be safe if we do.
}