Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
feat: refactored the logic
  • Loading branch information
oni-shiro committed Apr 18, 2025
commit 99b2fd7276cfe8ddfa7d4d8e7b31efd7f66abe65
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,7 @@ public override void Move(string sourceDirName, string destDirName)
var fullSourcePath = mockFileDataAccessor.Path.GetFullPath(sourceDirName).TrimSlashes();
var fullDestPath = mockFileDataAccessor.Path.GetFullPath(destDirName).TrimSlashes();

if (XFS.IsUnixPlatform() ? mockFileDataAccessor.StringOperations.Equals(fullSourcePath, fullDestPath)
: string.Equals(fullSourcePath, fullDestPath, StringComparison.Ordinal))
if (string.Equals(fullSourcePath, fullDestPath, StringComparison.Ordinal))
{
throw new IOException("Source and destination path must be different.");
}
Expand Down Expand Up @@ -535,17 +534,12 @@ public override void Move(string sourceDirName, string destDirName)
{
throw CommonExceptions.CouldNotFindPartOfPath(destDirName);
}
if (XFS.IsUnixPlatform())
{
if (mockFileDataAccessor.Directory.Exists(fullDestPath) || mockFileDataAccessor.File.Exists(fullDestPath))
{
throw CommonExceptions.CannotCreateBecauseSameNameAlreadyExists(fullDestPath);
}
}
else if (!string.Equals(fullSourcePath, fullDestPath, StringComparison.OrdinalIgnoreCase))

if (mockFileDataAccessor.Directory.Exists(fullDestPath) || mockFileDataAccessor.File.Exists(fullDestPath))
{
// In Windows, file/dir names are case sensetive, C:\\temp\\src and C:\\temp\\SRC and treated different
if (mockFileDataAccessor.Directory.Exists(fullDestPath) || mockFileDataAccessor.File.Exists(fullDestPath))
if (XFS.IsUnixPlatform() ||
!string.Equals(fullSourcePath, fullDestPath, StringComparison.OrdinalIgnoreCase))
{
throw CommonExceptions.CannotCreateBecauseSameNameAlreadyExists(fullDestPath);
}
Expand Down