Make it work on the mac.

This commit is contained in:
dougt%netscape.com 1999-03-10 18:39:01 +00:00
parent e985a85e0b
commit 923b334805
9 changed files with 34 additions and 25 deletions

View File

@ -1147,8 +1147,8 @@ PRInt32
nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsFileSpec* aSuggestedName, nsFileSpec** aRealName)
{
PRInt32 result;
const char* extractFileHere;
nsFilePath* extractFileHere = nsnull;
nsSpecialSystemDirectory tempFile(nsSpecialSystemDirectory::OS_TemporaryDirectory);
if (aSuggestedName == nsnull || aSuggestedName->Exists() )
@ -1170,28 +1170,29 @@ nsInstall::ExtractFileFromJar(const nsString& aJarfile, nsFileSpec* aSuggestedNa
// Create a temporary file to extract to.
tempFile.MakeUnique();
extractFileHere = tempFile.operator const char* ();
extractFileHere = new nsFilePath(tempFile);
}
else
{
// extract to the final destination.
extractFileHere = aSuggestedName->operator const char* ();
extractFileHere = new nsFilePath(*aSuggestedName);
}
// Return the filepath that we extracted to:
nsFileSpec *fileSpec = new nsFileSpec(extractFileHere);
nsFileSpec *fileSpec = new nsFileSpec(*extractFileHere);
// FIX: We will overwrite what is in the way. is this something that we want to do?
fileSpec->Delete(PR_FALSE);
result = ZIP_ExtractFile( mJarFileData, nsAutoCString(aJarfile), extractFileHere );
result = ZIP_ExtractFile( mJarFileData, nsAutoCString(aJarfile), (*extractFileHere) );
if (result == 0)
*aRealName = fileSpec;
//delete [] extractFileHere;
if (extractFileHere != nsnull)
delete extractFileHere;
return result;
}

View File

@ -24,6 +24,8 @@
#include "nsString.h"
#include "nsInstallErrorMessages.h"
#error
/// Need to rewrite!
char *

View File

@ -68,7 +68,7 @@ PRInt32 nsInstallExecute::Complete()
if (mExecutableFile == nsnull)
return nsInstall::INVALID_ARGUMENTS;
nsFileSpec appPath( *mExecutableFile, false);
nsFileSpec appPath( *mExecutableFile);
if (!appPath.Exists())
{

View File

@ -169,7 +169,7 @@ PRInt32 nsInstallFile::CompleteFileMove()
return -1;
}
if ( mExtracedFile->Equals(*mFinalFile) )
if ( *mExtracedFile == *mFinalFile )
{
/* No need to rename, they are the same */
result = 0;

View File

@ -95,8 +95,12 @@ nsInstallFolder::~nsInstallFolder()
void
nsInstallFolder::GetDirectoryPath(nsString& aDirectoryPath)
{
// We want the a NATIVE path.
aDirectoryPath.SetLength(0);
aDirectoryPath.Append(*mUrlPath);
// FIX NSFILESPEC - we need to have a GetDisplayString.
aDirectoryPath.Append(nsFilePath(*mUrlPath));
}

View File

@ -202,7 +202,7 @@ PRInt32 nsInstallPatch::Complete()
mInstall->GetPatch(&ikey, fileName);
if (fileName != nsnull && fileName->Equals(*mPatchedFile) )
if (fileName != nsnull && (*fileName == *mPatchedFile) )
{
// the patch has not been superceded--do final replacement
err = NativeReplace( *mTargetFile, *mPatchedFile );
@ -244,7 +244,7 @@ void nsInstallPatch::Abort()
mInstall->GetPatch(&ikey, fileName);
if (fileName != nsnull && fileName->Equals(*mPatchedFile) )
if (fileName != nsnull && (*fileName == *mPatchedFile) )
{
NativeDeleteFile( mPatchedFile );
}
@ -329,11 +329,13 @@ void*
nsInstallPatch::HashFilePath(const nsFilePath& aPath)
{
PRUint32 rv = 0;
if(aPath)
const char* cPath = aPath;
if(cPath != nsnull)
{
char ch;
char* filePath = nsnull;
strcpy(filePath, aPath);
strcpy(filePath, cPath);
while ((ch = *filePath++) != 0)
{

View File

@ -118,7 +118,7 @@ nsInstallTrigger::SetScriptObject(void *aScriptObject)
NS_IMETHODIMP
nsInstallTrigger::UpdateEnabled(PRBool* aReturn)
{
PREF_GetBoolPref( AUTOUPDATE_ENABLE_PREF, aReturn);
PREF_GetBoolPref( (const char*) AUTOUPDATE_ENABLE_PREF, (bool*)aReturn);
return NS_OK;
}

View File

@ -1,7 +1,12 @@
#include "nsSoftwareUpdate.h"
#include "nsSoftwareUpdateRun.h"
#ifndef XP_MAC
#include <sys/stat.h>
#else
#include <stat.h>
#endif
#include "nspr.h"
#include "nsRepository.h"
@ -101,7 +106,7 @@ extern "C" NS_EXPORT PRInt32 Install(char* jarFile, char* args)
installJSFileSpec += "install.js";
installJSFileSpec.MakeUnique();
const char* installJSFile = installJSFileSpec.operator const char* ();
const char* installJSFile = nsFilePath(installJSFileSpec);
// Extract the install.js file.
result = ZIP_ExtractFile( hZip, "install.js", installJSFile );

View File

@ -61,12 +61,7 @@ DownloadJar(const nsString& aUrlString, const nsString& aSaveLocationString)
result = NS_OpenURL(pURL, aListener);
/* If the open failed... */
if (NS_OK != result)
{
return result;
}
return result;
}
@ -153,7 +148,7 @@ nsSoftwareUpdateListener::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream
do
{
err = pIStream->Read(buffer, 0, BUF_SIZE, &len);
err = pIStream->Read(buffer, BUF_SIZE, &len);
if (err == NS_OK)
{