This commit is contained in:
sgehani%netscape.com 1999-07-03 19:00:45 +00:00
Родитель f443f579a2
Коммит 3385a67736
5 изменённых файлов: 33 добавлений и 11 удалений

Просмотреть файл

@ -751,10 +751,6 @@ nsInstall::GetComponentFolder(const nsString& aComponentName, const nsString& aS
if(aSubdirectory != "")
{
nsfsDir += aSubdirectory;
if(!nsfsDir.Exists())
{
nsfsDir.CreateDirectory();
}
}
*aFolder = new nsString(nsfsDir.GetNativePathCString());
}

Просмотреть файл

@ -122,6 +122,7 @@ class nsInstall
UNINSTALL_FAILED = -223,
PACKAGE_FOLDER_NOT_SET = -224,
EXTRACTION_FAILED = -225,
FILENAME_ALREADY_USED = -226,
GESTALT_UNKNOWN_ERR = -5550,
GESTALT_INVALID_ARGUMENT = -5551,

Просмотреть файл

@ -107,14 +107,36 @@ nsInstallFile::nsInstallFile(nsInstall* inInstall,
delete [] qualifiedRegNameString;
mFinalFile = new nsFileSpec(folderSpec);
if ( mFinalFile->Exists() )
{
// is there a file with the same name as the proposed folder?
if ( mFinalFile->IsFile() )
{
*error = nsInstall::FILENAME_ALREADY_USED;
return;
}
// else this directory already exists, so do nothing
}
else
{
/* the nsFileSpecMac.cpp operator += requires "this" (the nsFileSpec)
* to be an existing dir
*/
int dirPermissions = 755; // std default for UNIX, ignored otherwise
mFinalFile->CreateDir(dirPermissions);
}
mFinalFile = new nsFileSpec(folderSpec);
*mFinalFile += inPartialPath;
mReplaceFile = mFinalFile->Exists();
if (mReplaceFile == PR_FALSE)
{
/* although it appears that we are creating the dir _again_ it is necessary
* when inPartialPath has arbitrary levels of nested dirs before the leaf
*/
nsFileSpec parent;
mFinalFile->GetParent(parent);
nsFileSpec makeDirs(parent.GetCString(), PR_TRUE);

Просмотреть файл

@ -106,7 +106,10 @@ nsInstallFolder::nsInstallFolder(const nsString& aFolderID, const nsString& aRel
tempString += aRelativePath;
mFileSpec = new nsFileSpec(tempString);
// This paranoia makes no sense since dirCheck.IsDirectory() && dirCheck.Exists() !
// vvvv
// make sure that the directory is created.
// ^^^^
nsFileSpec(mFileSpec->GetCString(), PR_TRUE);
}
else
@ -273,7 +276,7 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
mFileSpec = nsnull;
return;
}
#ifndef XP_MAC
if (aRelativePath.Length() > 0)
{
nsString tempPath(aRelativePath);
@ -283,9 +286,6 @@ nsInstallFolder::SetDirectoryPath(const nsString& aFolderID, const nsString& aRe
*mFileSpec += tempPath;
}
#endif
// make sure that the directory is created.
nsFileSpec(mFileSpec->GetCString(), PR_TRUE);
}
}

Просмотреть файл

@ -2344,6 +2344,9 @@ static JSConstDoubleSpec install_constants[] =
{ nsInstall::PATCH_BAD_CHECKSUM_TARGET, "PATCH_BAD_CHECKSUM_TARGET" },
{ nsInstall::PATCH_BAD_CHECKSUM_RESULT, "PATCH_BAD_CHECKSUM_RESULT" },
{ nsInstall::UNINSTALL_FAILED, "UNINSTALL_FAILED" },
{ nsInstall::PACKAGE_FOLDER_NOT_SET, "PACKAGE_FOLDER_NOT_SET" },
{ nsInstall::EXTRACTION_FAILED, "EXTRACTION_FAILED" },
{ nsInstall::FILENAME_ALREADY_USED, "FILENAME_ALREADY_USED" },
{ nsInstall::GESTALT_UNKNOWN_ERR, "GESTALT_UNKNOWN_ERR" },
{ nsInstall::GESTALT_INVALID_ARGUMENT, "GESTALT_INVALID_ARGUMENT" },
{ nsInstall::SUCCESS, "SUCCESS" },