From 10eeba9d76b38184b0d4e6fc01a0814270fce032 Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Mon, 22 Feb 1999 01:31:57 +0000 Subject: [PATCH] Bug Fixes. git-svn-id: svn://10.0.0.236/branches/BASE_17_FEB_99@21447 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/base/src/unix/nsFileSpecUnix.cpp | 14 +++++++------- mozilla/xpcom/io/nsFileSpecUnix.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mozilla/base/src/unix/nsFileSpecUnix.cpp b/mozilla/base/src/unix/nsFileSpecUnix.cpp index d06e901e9a8..7327d09631b 100644 --- a/mozilla/base/src/unix/nsFileSpecUnix.cpp +++ b/mozilla/base/src/unix/nsFileSpecUnix.cpp @@ -200,7 +200,6 @@ static int CrudeFileCopy(const char* in, const char* out) ifp = fopen (in, "r"); if (!ifp) { - unlink(in); return -1; } @@ -208,7 +207,6 @@ static int CrudeFileCopy(const char* in, const char* out) if (!ofp) { fclose (ifp); - unlink(in); return -1; } @@ -220,7 +218,6 @@ static int CrudeFileCopy(const char* in, const char* out) { fclose (ofp); fclose (ifp); - unlink(in); unlink(out); return -1; } @@ -229,7 +226,6 @@ static int CrudeFileCopy(const char* in, const char* out) } fclose (ofp); fclose (ifp); - unlink(in); if (stat_result == 0) { @@ -250,7 +246,7 @@ nsresult nsFileSpec::Copy(const nsFileSpec& inParentDirectory) const { char *leafname = GetLeafName(); char* destPath = nsFileSpecHelpers::StringDup(inParentDirectory, ( strlen(inParentDirectory) + 1 + strlen(leafname) ) ); - strcat(destPath, "\\"); + strcat(destPath, "/"); strcat(destPath, leafname); delete [] leafname; @@ -275,12 +271,16 @@ nsresult nsFileSpec::Move(const nsFileSpec& inNewParentDirectory) const = nsFileSpecHelpers::StringDup( inNewParentDirectory, strlen(inNewParentDirectory) + 1 + strlen(leafname)); - strcat(destPath, "\\"); + strcat(destPath, "/"); strcat(destPath, leafname); delete [] leafname; result = NS_FILE_RESULT(CrudeFileCopy(*this, destPath)); - delete [] destPath; + if (result == NS_OK) + { + Delete(PR_FALSE); + } + delete [] destPath; } return result; } diff --git a/mozilla/xpcom/io/nsFileSpecUnix.cpp b/mozilla/xpcom/io/nsFileSpecUnix.cpp index d06e901e9a8..7327d09631b 100644 --- a/mozilla/xpcom/io/nsFileSpecUnix.cpp +++ b/mozilla/xpcom/io/nsFileSpecUnix.cpp @@ -200,7 +200,6 @@ static int CrudeFileCopy(const char* in, const char* out) ifp = fopen (in, "r"); if (!ifp) { - unlink(in); return -1; } @@ -208,7 +207,6 @@ static int CrudeFileCopy(const char* in, const char* out) if (!ofp) { fclose (ifp); - unlink(in); return -1; } @@ -220,7 +218,6 @@ static int CrudeFileCopy(const char* in, const char* out) { fclose (ofp); fclose (ifp); - unlink(in); unlink(out); return -1; } @@ -229,7 +226,6 @@ static int CrudeFileCopy(const char* in, const char* out) } fclose (ofp); fclose (ifp); - unlink(in); if (stat_result == 0) { @@ -250,7 +246,7 @@ nsresult nsFileSpec::Copy(const nsFileSpec& inParentDirectory) const { char *leafname = GetLeafName(); char* destPath = nsFileSpecHelpers::StringDup(inParentDirectory, ( strlen(inParentDirectory) + 1 + strlen(leafname) ) ); - strcat(destPath, "\\"); + strcat(destPath, "/"); strcat(destPath, leafname); delete [] leafname; @@ -275,12 +271,16 @@ nsresult nsFileSpec::Move(const nsFileSpec& inNewParentDirectory) const = nsFileSpecHelpers::StringDup( inNewParentDirectory, strlen(inNewParentDirectory) + 1 + strlen(leafname)); - strcat(destPath, "\\"); + strcat(destPath, "/"); strcat(destPath, leafname); delete [] leafname; result = NS_FILE_RESULT(CrudeFileCopy(*this, destPath)); - delete [] destPath; + if (result == NS_OK) + { + Delete(PR_FALSE); + } + delete [] destPath; } return result; }