@@ -1740,9 +1740,9 @@ static bool IsRemoteFilePath(LPCWSTR aPath, bool& aRemote) {
17401740 return true ;
17411741}
17421742
1743- nsresult nsLocalFile::CopySingleFile (nsIFile* aSourceFile, nsIFile* aDestParent,
1744- const nsAString& aNewName,
1745- uint32_t aOptions) {
1743+ nsresult nsLocalFile::MoveOrCopyAsSingleFileOrDir ( nsIFile* aDestParent,
1744+ const nsAString& aNewName,
1745+ uint32_t aOptions) {
17461746 nsresult rv = NS_OK;
17471747 nsAutoString filePath;
17481748
@@ -1762,31 +1762,28 @@ nsresult nsLocalFile::CopySingleFile(nsIFile* aSourceFile, nsIFile* aDestParent,
17621762
17631763 if (aNewName.IsEmpty ()) {
17641764 nsAutoString aFileName;
1765- aSourceFile-> GetLeafName (aFileName);
1765+ GetLeafName (aFileName);
17661766 destPath.Append (aFileName);
17671767 } else {
17681768 destPath.Append (aNewName);
17691769 }
17701770
17711771 if (aOptions & FollowSymlinks) {
1772- rv = aSourceFile-> GetTarget (filePath);
1772+ rv = GetTarget (filePath);
17731773 if (filePath.IsEmpty ()) {
1774- rv = aSourceFile-> GetPath (filePath);
1774+ rv = GetPath (filePath);
17751775 }
17761776 } else {
1777- rv = aSourceFile-> GetPath (filePath);
1777+ rv = GetPath (filePath);
17781778 }
17791779
17801780 if (NS_FAILED(rv)) {
17811781 return rv;
17821782 }
17831783
17841784#ifdef DEBUG
1785- nsCOMPtr<nsILocalFileWin> srcWinFile = do_QueryInterface (aSourceFile);
1786- MOZ_ASSERT (srcWinFile);
1787-
17881785 bool srcUseDOSDevicePathSyntax;
1789- srcWinFile-> GetUseDOSDevicePathSyntax (&srcUseDOSDevicePathSyntax);
1786+ GetUseDOSDevicePathSyntax (&srcUseDOSDevicePathSyntax);
17901787
17911788 nsCOMPtr<nsILocalFileWin> destWinFile = do_QueryInterface (aDestParent);
17921789 MOZ_ASSERT (destWinFile);
@@ -1993,7 +1990,7 @@ nsresult nsLocalFile::CopyMove(nsIFile* aParentDir, const nsAString& aNewName,
19931990 if (!aParentDir) {
19941991 aOptions |= SkipNtfsAclReset;
19951992 }
1996- rv = CopySingleFile ( this , newParentDir, aNewName, aOptions);
1993+ rv = MoveOrCopyAsSingleFileOrDir ( newParentDir, aNewName, aOptions);
19971994 done = NS_SUCCEEDED(rv);
19981995 // If we are moving a directory and that fails, fallback on directory
19991996 // enumeration. See bug 231300 for details.
@@ -2247,7 +2244,7 @@ nsLocalFile::RenameTo(nsIFile* aNewParentDir, const nsAString& aNewName) {
22472244 options |= SkipNtfsAclReset;
22482245 }
22492246 // Move single file, or move a directory
2250- return CopySingleFile ( this , targetParentDir, aNewName, options);
2247+ return MoveOrCopyAsSingleFileOrDir ( targetParentDir, aNewName, options);
22512248}
22522249
22532250NS_IMETHODIMP
0 commit comments