Index: mozilla/xpcom/io/nsLocalFileUnix.cpp =================================================================== RCS file: /cvsroot/mozilla/xpcom/io/nsLocalFileUnix.cpp,v retrieving revision 1.132 diff -pU20 -r1.132 mozilla/xpcom/io/nsLocalFileUnix.cpp --- mozilla/xpcom/io/nsLocalFileUnix.cpp +++ mozilla/xpcom/io/nsLocalFileUnix.cpp @@ -654,44 +654,44 @@ nsLocalFile::CopyDirectoryTo(nsIFile *ne * dirCheck is used for various boolean test results such as from Equals, * Exists, isDir, etc. */ PRBool dirCheck, isSymlink; PRUint32 oldPerms; if (NS_FAILED(rv = IsDirectory(&dirCheck))) return rv; if (!dirCheck) return CopyToNative(newParent, EmptyCString()); if (NS_FAILED(rv = Equals(newParent, &dirCheck))) return rv; if (dirCheck) { // can't copy dir to itself return NS_ERROR_INVALID_ARG; } if (NS_FAILED(rv = newParent->Exists(&dirCheck))) return rv; + // get the dirs old permissions + if (NS_FAILED(rv = GetPermissions(&oldPerms))) + return rv; if (!dirCheck) { - // get the dirs old permissions - if (NS_FAILED(rv = GetPermissions(&oldPerms))) - return rv; if (NS_FAILED(rv = newParent->Create(DIRECTORY_TYPE, oldPerms))) return rv; } else { // dir exists lets try to use leaf nsCAutoString leafName; if (NS_FAILED(rv = GetNativeLeafName(leafName))) return rv; if (NS_FAILED(rv = newParent->AppendNative(leafName))) return rv; if (NS_FAILED(rv = newParent->Exists(&dirCheck))) return rv; if (dirCheck) return NS_ERROR_FILE_ALREADY_EXISTS; // dest exists if (NS_FAILED(rv = newParent->Create(DIRECTORY_TYPE, oldPerms))) return rv; } nsCOMPtr dirIterator; if (NS_FAILED(rv = GetDirectoryEntries(getter_AddRefs(dirIterator)))) return rv;