diff --git a/mozilla/xpcom/io/nsLocalFileOSX.cpp b/mozilla/xpcom/io/nsLocalFileOSX.cpp index 88b2d0cb96f..9e223ee7aa2 100644 --- a/mozilla/xpcom/io/nsLocalFileOSX.cpp +++ b/mozilla/xpcom/io/nsLocalFileOSX.cpp @@ -599,6 +599,17 @@ NS_IMETHODIMP nsLocalFile::MoveToNative(nsIFile *newParentDir, const nsACString& if (NS_FAILED(rv)) return rv; } + else { + PRBool exists; + rv = parentDir->Exists(&exists); + if (NS_FAILED(rv)) + return rv; + if (!exists) { + rv = parentDir->Create(nsIFile::DIRECTORY_TYPE, 0777); + if (NS_FAILED(rv)) + return rv; + } + } nsCAutoString destPath; rv = parentDir->GetNativePath(destPath); diff --git a/mozilla/xpcom/tests/nsIFileTest.cpp b/mozilla/xpcom/tests/nsIFileTest.cpp index 18d3a8ce358..3646789ec8c 100644 --- a/mozilla/xpcom/tests/nsIFileTest.cpp +++ b/mozilla/xpcom/tests/nsIFileTest.cpp @@ -377,7 +377,11 @@ int main(void) CreationTest("/tmp", "mumble/a/b/c/d/e/f/g/h/i/j/k/", nsIFile::DIRECTORY_TYPE, 0644); DeletionTest("/tmp", "mumble", PR_TRUE); - CopyTest("/tmp/test.txt", "/tmp/foo"); + + CreationTest("/tmp", "file", nsIFile::NORMAL_FILE_TYPE, 0644); + CopyTest("/tmp/file", "/tmp/newDir"); + MoveTest("/tmp/file", "/tmp/newDir/anotherNewDir"); + DeletionTest("/tmp", "newDir", PR_TRUE); #endif /* XP_UNIX */ #endif /* XP_WIN || XP_OS2 */