Subversion Repositories spk

Rev

Rev 266 | Rev 277 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 266 Rev 271
Line 1253... Line 1253...
1253
}
1253
}
1254
 
1254
 
1255
CBaseFile *CPackages::openPackage(const Utils::WString &file, int *error, CProgressInfo *progress, int readtype, int flags)
1255
CBaseFile *CPackages::openPackage(const Utils::WString &file, int *error, CProgressInfo *progress, int readtype, int flags)
1256
{
1256
{
1257
	int check = checkOpenPackage(file, error);
1257
	int check = checkOpenPackage(file, error);
1258
	if ( *error == -1 )
1258
	if (*error == -1)
1259
		return NULL;
1259
		return NULL;
1260
 
1260
 
1261
	CBaseFile *installFile = 0;
1261
	CBaseFile *installFile = 0;
1262
 
1262
 
1263
	if ( progress )
1263
	if ( progress )
Line 1277... Line 1277...
1277
				{
1277
				{
1278
					delete installFile;
1278
					delete installFile;
1279
					return NULL;
1279
					return NULL;
1280
				}
1280
				}
1281
				break;
1281
				break;
-
 
1282
			}
-
 
1283
			// try and open as archive
-
 
1284
			else if(CFileIO(file).isFileExtension(L"spk"))
-
 
1285
			{
-
 
1286
				if (_check_archive_fromZip(file))
-
 
1287
				{
-
 
1288
					installFile = createFromArchive(file, true);
-
 
1289
					if (installFile)
-
 
1290
						return installFile;
-
 
1291
				}
1282
			}
1292
			}
1283
			*error = INSTALLERR_INVALID;
1293
			*error = INSTALLERR_INVALID;
1284
			return NULL;
1294
			return NULL;
1285
		case SPKFILE_BASE:
1295
		case SPKFILE_BASE:
1286
			installFile = new CBaseFile();
1296
			installFile = new CBaseFile();
Line 3357... Line 3367...
3357
 * Any directories left empty when disabling files are then removed
3367
 * Any directories left empty when disabling files are then removed
3358
 *
3368
 *
3359
 * param: package	- Package file to be disabled
3369
 * param: package	- Package file to be disabled
3360
 * param: errors	- A string list used to add the status as it progresses, used in debugging output
3370
 * param: errors	- A string list used to add the status as it progresses, used in debugging output
3361
 * param: progress	- The progress class, updates the progress of the current disabling.  Needs a divered class to report the progress somewhere
3371
 * param: progress	- The progress class, updates the progress of the current disabling.  Needs a divered class to report the progress somewhere
3362
 *
3372
 *
3363
 * return: boolean, true if there was no errors, otherwise false
3373
 * return: boolean, true if there was no errors, otherwise false
3364
 */
3374
 */
3365
bool CPackages::disablePackage(CBaseFile *package, Utils::WStringList *errors, CProgressInfo *progress )
3375
bool CPackages::disablePackage(CBaseFile *package, Utils::WStringList *errors, CProgressInfo *progress )
3366
{
3376
{
3367
	// if already disabled, just skip
3377
	// if already disabled, just skip
3368
	if ( !package->IsEnabled() )
3378
	if ( !package->IsEnabled() )
3369
		return true;
3379
		return true;
3370
 
3380
 
3371
	m_lDisableList.clear();
3381
	m_lDisableList.clear();
3372
	if ( this->PrepareDisablePackage(package) )
3382
	if ( this->PrepareDisablePackage(package) )
3373
		return this->disablePreparedPackages(errors, progress);
3383
		return this->disablePreparedPackages(errors, progress);
3374
 
3384
 
3375
	return false;
3385
	return false;
3376
}
3386
}
3377
 
3387
 
3378
 
3388
 
3379
/**
3389
/**
3380
 * Find a Package
3390
 * Find a Package
3381
 *
3391
 *
3382
 * Finds a matching package so we can find if one is already installed
3392
 * Finds a matching package so we can find if one is already installed
3383
 *
3393
 *
Line 3405... Line 3415...
3405
{
3415
{
3406
	return findNextPackageWithFile(NULL, f);
3416
	return findNextPackageWithFile(NULL, f);
3407
}
3417
}
3408
 
3418
 
3409
CBaseFile *CPackages::findNextPackageWithFile(CBaseFile *p, C_File *f) const
3419
CBaseFile *CPackages::findNextPackageWithFile(CBaseFile *p, C_File *f) const
3410
{
3420
{
3411
	bool startCheck = (p) ? false : true;
3421
	bool startCheck = (p) ? false : true;
3412
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3422
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3413
	{
3423
	{
3414
		if ( startCheck )
3424
		if ( startCheck )
3415
		{
3425
		{
3416
			if ( node->Data()->IsFileAdded(f) )
3426
			if ( node->Data()->IsFileAdded(f) )
3417
				return node->Data();
3427
				return node->Data();
3418
		}
3428
		}
3419
		else if ( p == node->Data() )
3429
		else if ( p == node->Data() )
3420
			startCheck = true;
3430
			startCheck = true;
3421
	}
3431
	}
3422
 
3432
 
3423
	return NULL;
3433
	return NULL;
3424
}
3434
}
3425
 
3435
 
3426
 
3436
 
3427
/**
3437
/**
3428
 * Find a File
3438
 * Find a File
3429
 *
3439
 *
3430
 * Searches for a file matching the filetype and filename
3440
 * Searches for a file matching the filetype and filename
3431
 * Optional dir is used for extras files
3441
 * Optional dir is used for extras files
Line 3437... Line 3447...
3437
		C_File *f = node->Data();
3447
		C_File *f = node->Data();
3438
		if ( f->GetFileType() != filetype )
3448
		if ( f->GetFileType() != filetype )
3439
			continue;
3449
			continue;
3440
 
3450
 
3441
		if ( !f->filename().Compare(filename) )
3451
		if ( !f->filename().Compare(filename) )
3442
			continue;
3452
			continue;
3443
 
3453
 
3444
		if ( !dir.empty() && f->dir().Compare(dir) )
3454
		if ( !dir.empty() && f->dir().Compare(dir) )
3445
			continue;
3455
			continue;
3446
 
3456
 
3447
		return f;
3457
		return f;
3448
	}
3458
	}
3449
 
3459
 
3450
	return NULL;
3460
	return NULL;
3451
}
3461
}
3452
 
3462
 
3453
CArchiveFile *CPackages::findArchivePackage(const Utils::WString &name) const
3463
CArchiveFile *CPackages::findArchivePackage(const Utils::WString &name) const
3454
{
3464
{
3455
	// interate through all packages
3465
	// interate through all packages
3456
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3466
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
3457
	{
3467
	{
3458
		CBaseFile *file = node->Data();
3468
		CBaseFile *file = node->Data();
3459
 
3469
 
3460
		// only look for archive packages
3470
		// only look for archive packages
3461
		if ( file->GetType() != TYPE_ARCHIVE )
3471
		if ( file->GetType() != TYPE_ARCHIVE )
3462
			continue;
3472
			continue;
3463
 
3473
 
Line 3486... Line 3496...
3486
		if ( file->GetType() != TYPE_SPK )
3496
		if ( file->GetType() != TYPE_SPK )
3487
			continue;
3497
			continue;
3488
 
3498
 
3489
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3499
		// now compare the name and author, "Compare" is a non case senseative check, opposed to ==.
3490
		if ( file->name().Compare(name) && file->author().Compare(author) )
3500
		if ( file->name().Compare(name) && file->author().Compare(author) )
3491
			return file;
3501
			return file;
3492
	}
3502
	}
3493
 
3503
 
3494
	// nothing found
3504
	// nothing found
3495
	return 0;
3505
	return 0;
3496
}
3506
}
Line 3871... Line 3881...
3871
		{
3881
		{
3872
			SNeededLibrary* nl = node->Data();
3882
			SNeededLibrary* nl = node->Data();
3873
			if (!checkInstalledDependacy((nl->sName.Compare(L"<package>")) ? p->name() : nl->sName, (nl->sAuthor.Compare(L"<author>")) ? p->author() : nl->sAuthor, nl->sMinVersion, (nl->sName.Compare(L"<package>")) ? false : onlyEnabled, (nl->sName.Compare(L"<package>")) ? false : includePrepared))
3883
			if (!checkInstalledDependacy((nl->sName.Compare(L"<package>")) ? p->name() : nl->sName, (nl->sAuthor.Compare(L"<author>")) ? p->author() : nl->sAuthor, nl->sMinVersion, (nl->sName.Compare(L"<package>")) ? false : onlyEnabled, (nl->sName.Compare(L"<package>")) ? false : includePrepared))
3874
			{
3884
			{
3875
				const SAvailablePackage *available = findAvailablePackage((nl->sName.Compare(L"<package>")) ? p->name() : nl->sName, (nl->sAuthor.Compare(L"<author>")) ? p->author() : nl->sAuthor);
3885
				const SAvailablePackage *available = findAvailablePackage((nl->sName.Compare(L"<package>")) ? p->name() : nl->sName, (nl->sAuthor.Compare(L"<author>")) ? p->author() : nl->sAuthor);
3876
				if (available)
3886
				if (available)
3877
					list.push_back(available);
3887
					list.push_back(available);
3878
				++count;
3888
				++count;
3879
			}
3889
			}
3880
		}
3890
		}
3881
	}
3891
	}
3882
 
3892
 
3883
	if (p->GetType() == TYPE_SPK)
3893
	if (p->GetType() == TYPE_SPK)
3884
	{
3894
	{
3885
		CSpkFile* spk = (CSpkFile*)p;
3895
		CSpkFile* spk = (CSpkFile*)p;
Line 3908... Line 3918...
3908
			if (!found)
3918
			if (!found)
3909
			{
3919
			{
3910
				const SAvailablePackage* available = findAvailablePackage(spk->otherName(), spk->otherAuthor());
3920
				const SAvailablePackage* available = findAvailablePackage(spk->otherName(), spk->otherAuthor());
3911
				if (available)
3921
				if (available)
3912
					list.push_back(available);
3922
					list.push_back(available);
3913
				++count;
3923
				++count;
3914
			}
3924
			}
3915
		}
3925
		}
3916
	}
3926
	}
3917
 
3927
 
3918
	return count;
3928
	return count;
Line 3957... Line 3967...
3957
						}
3967
						}
3958
					}
3968
					}
3959
				}
3969
				}
3960
				else
3970
				else
3961
					found = false;
3971
					found = false;
3962
			}
3972
			}
3963
 
3973
 
3964
			if ( !found )
3974
			if ( !found )
3965
			{
3975
			{
3966
				if ( list )
3976
				if ( list )
3967
					list->pushBack(spk->otherName(), spk->otherAuthor());
3977
					list->pushBack(spk->otherName(), spk->otherAuthor());
Line 4002... Line 4012...
4002
	}
4012
	}
4003
 
4013
 
4004
	m_lInstallList.RemoveEmpty();
4014
	m_lInstallList.RemoveEmpty();
4005
 
4015
 
4006
	return count;
4016
	return count;
4007
}
4017
}
4008
 
4018
 
4009
 
4019
 
4010
/**
4020
/**
4011
 * Remove uninstall file
4021
 * Remove uninstall file
4012
 *
4022
 *
4013
 * Removes a single uninstall file
4023
 * Removes a single uninstall file
4014
 */
4024
 */
4015
bool CPackages::removeUninstallFile(C_File *file, Utils::WStringList *errors)
4025
bool CPackages::removeUninstallFile(C_File *file, Utils::WStringList *errors)
Line 4017... Line 4027...
4017
	CFileIO fio(file->filePointer());
4027
	CFileIO fio(file->filePointer());
4018
	if ( fio.exists() )
4028
	if ( fio.exists() )
4019
	{
4029
	{
4020
		if ( fio.remove() ) {
4030
		if ( fio.remove() ) {
4021
			this->addLogEntry(SPKINSTALL_UNINSTALL_REMOVE, file->getNameDirectory(NULL), errors);
4031
			this->addLogEntry(SPKINSTALL_UNINSTALL_REMOVE, file->getNameDirectory(NULL), errors);
4022
			return true;
4032
			return true;
4023
		}
4033
		}
4024
		else if ( errors )
4034
		else if ( errors )
4025
			this->addLogEntry(SPKINSTALL_UNINSTALL_REMOVE_FAIL, file->getNameDirectory(NULL), errors);
4035
			this->addLogEntry(SPKINSTALL_UNINSTALL_REMOVE_FAIL, file->getNameDirectory(NULL), errors);
4026
	}
4036
	}
4027
 
4037
 
4028
	return false;
4038
	return false;
Line 4083... Line 4093...
4083
 * Remove unused shared file
4093
 * Remove unused shared file
4084
 *
4094
 *
4085
 * Removes a single file
4095
 * Removes a single file
4086
 */
4096
 */
4087
bool CPackages::removeSharedFile(C_File *file, Utils::WStringList *errors)
4097
bool CPackages::removeSharedFile(C_File *file, Utils::WStringList *errors)
4088
{
4098
{
4089
	CFileIO fio(file->filePointer());
4099
	CFileIO fio(file->filePointer());
4090
	if ( fio.exists() )
4100
	if ( fio.exists() )
4091
	{
4101
	{
4092
		if ( fio.remove() ) {
4102
		if ( fio.remove() ) {
4093
			this->addLogEntry(SPKINSTALL_SHARED, file->getNameDirectory(NULL), errors);
4103
			this->addLogEntry(SPKINSTALL_SHARED, file->getNameDirectory(NULL), errors);
Line 4132... Line 4142...
4132
			continue;
4142
			continue;
4133
 
4143
 
4134
		if (removeSharedFile(file, errors) )
4144
		if (removeSharedFile(file, errors) )
4135
			++done;
4145
			++done;
4136
		node->ChangeData(NULL);
4146
		node->ChangeData(NULL);
4137
	}
4147
	}
4138
 
4148
 
4139
	m_lFiles.RemoveEmpty();
4149
	m_lFiles.RemoveEmpty();
4140
 
4150
 
4141
	return done;
4151
	return done;
4142
}
4152
}
4143
 
4153
 
4144
/**
4154
/**
4145
 * Any Unused Shared
4155
 * Any Unused Shared
Line 4163... Line 4173...
4163
		// only do ones that are no longer needed
4173
		// only do ones that are no longer needed
4164
		if ( file->getUsed() )
4174
		if ( file->getUsed() )
4165
			continue;
4175
			continue;
4166
 
4176
 
4167
		return true;
4177
		return true;
4168
	}
4178
	}
4169
 
4179
 
4170
	return false;
4180
	return false;
4171
 
4181
 
4172
}
4182
}
4173
 
4183
 
4174
void CPackages::shuffleTextFiles(Utils::WStringList *errors)
4184
void CPackages::shuffleTextFiles(Utils::WStringList *errors)
4175
{
4185
{
4176
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
4186
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
4177
	{
4187
	{
4178
		C_File *f = node->Data();
4188
		C_File *f = node->Data();
4179
		// only do files that are enabled
4189
		// only do files that are enabled
4180
		if ( f->IsDisabled() )
4190
		if ( f->IsDisabled() )
4181
			continue;
4191
			continue;
4182
 
4192
 
4183
		if ( f->GetFileType() != FILETYPE_TEXT )
4193
		if ( f->GetFileType() != FILETYPE_TEXT )
4184
			continue;
4194
			continue;
4185
 
4195
 
4186
		// check if the file is an auto text file
4196
		// check if the file is an auto text file
4187
		if ( !f->isAutoTextFile() )
4197
		if ( !f->isAutoTextFile() )
4188
			continue;
4198
			continue;
4189
 
4199
 
4190
		// we need to rename it
4200
		// we need to rename it
4191
		int current = findNextTextFile();
4201
		int current = findNextTextFile();
4192
		if ( current < f->textFileID() )
4202
		if ( current < f->textFileID() )
4193
		{
4203
		{
4194
			CFileIO moveFile(f->filePointer());
4204
			CFileIO moveFile(f->filePointer());
Line 4233... Line 4243...
4233
		if (!p->AnyFileType(FILETYPE_MOD)) continue;
4243
		if (!p->AnyFileType(FILETYPE_MOD)) continue;
4234
 
4244
 
4235
		if (p->AnyDependacies())
4245
		if (p->AnyDependacies())
4236
		{
4246
		{
4237
			for (SNeededLibrary* nl = p->GetNeededLibraries()->First(); nl; nl = p->GetNeededLibraries()->Next())
4247
			for (SNeededLibrary* nl = p->GetNeededLibraries()->First(); nl; nl = p->GetNeededLibraries()->Next())
4238
			{
4248
			{
4239
				auto package = findPackage(nl->sName, nl->sAuthor);
4249
				auto package = findPackage(nl->sName, nl->sAuthor);
4240
				if (package)
4250
				if (package)
4241
				{
4251
				{
4242
					packagesBefore.insert(package);
4252
					packagesBefore.insert(package);
4243
					packagesAfter[p].insert(package);
4253
					packagesAfter[p].insert(package);
Line 4265... Line 4275...
4265
			for (auto itr = list.begin(); itr != list.end(); itr++)
4275
			for (auto itr = list.begin(); itr != list.end(); itr++)
4266
			{
4276
			{
4267
				auto package = findPackage((*itr)->str, (*itr)->data);
4277
				auto package = findPackage((*itr)->str, (*itr)->data);
4268
				if (package)				
4278
				if (package)				
4269
					packagesAfter[package].insert(p);
4279
					packagesAfter[package].insert(p);
4270
			}
4280
			}
4271
		}
4281
		}
4272
		if (!p->getFakePatchAfterOrder().empty())
4282
		if (!p->getFakePatchAfterOrder().empty())
4273
		{
4283
		{
4274
			auto& list = p->getFakePatchAfterOrder();
4284
			auto& list = p->getFakePatchAfterOrder();
4275
			for (auto itr = list.begin(); itr != list.end(); itr++)
4285
			for (auto itr = list.begin(); itr != list.end(); itr++)
Line 4296... Line 4306...
4296
				if (findItr != addList.end())
4306
				if (findItr != addList.end())
4297
				{
4307
				{
4298
					auto checkItr = std::find(addTo.begin(), addTo.end(), p);
4308
					auto checkItr = std::find(addTo.begin(), addTo.end(), p);
4299
					if(checkItr == addTo.end())
4309
					if(checkItr == addTo.end())
4300
						addTo.push_back(p);
4310
						addTo.push_back(p);
4301
				}
4311
				}
4302
			}
4312
			}
4303
		}
4313
		}
4304
 
4314
 
4305
		// now add all the others
4315
		// now add all the others
4306
		for (auto itr = addList.begin(); itr != addList.end(); itr++)
4316
		for (auto itr = addList.begin(); itr != addList.end(); itr++)
4307
		{
4317
		{
4308
			auto checkItr = std::find(addTo.begin(), addTo.end(), *itr);
4318
			auto checkItr = std::find(addTo.begin(), addTo.end(), *itr);
Line 4395... Line 4405...
4395
						lowestFile = file;
4405
						lowestFile = file;
4396
					else
4406
					else
4397
					{
4407
					{
4398
						if ( file->baseName().toInt() < lowestFile->baseName().toInt() )
4408
						if ( file->baseName().toInt() < lowestFile->baseName().toInt() )
4399
							lowestFile = file;
4409
							lowestFile = file;
4400
					}
4410
					}
4401
				}
4411
				}
4402
 
4412
 
4403
				if ( !lowestFile ) // no more files ?
4413
				if ( !lowestFile ) // no more files ?
4404
					break;
4414
					break;
4405
 
4415
 
4406
				// check its filename, it might already be in the correct place
4416
				// check its filename, it might already be in the correct place
Line 4426... Line 4436...
4426
					shufflePatchTo(lowestFile, lowest, errors);
4436
					shufflePatchTo(lowestFile, lowest, errors);
4427
				}
4437
				}
4428
 
4438
 
4429
				doneList.push_back(lowestFile); // we've done this file now
4439
				doneList.push_back(lowestFile); // we've done this file now
4430
				lowest++; // move up the lowest ready for the next patch
4440
				lowest++; // move up the lowest ready for the next patch
4431
			}
4441
			}
4432
		}
4442
		}
4433
	}
4443
	}
4434
 
4444
 
4435
	// now lets shuffle the rest
4445
	// now lets shuffle the rest
4436
	// now find any packages with greater fake patchs and fill the gaps
4446
	// now find any packages with greater fake patchs and fill the gaps
-
 
4447
	std::vector<C_File*> fakepatches;
4437
	for ( CListNode<C_File> *node = m_lFiles.Front(); node; node = node->next() )
4448
	for (CListNode<C_File>* node = m_lFiles.Front(); node; node = node->next())
4438
	{
4449
	{
4439
		C_File *f = node->Data();
4450
		C_File* f = node->Data();
4440
		// already done?
4451
		// already done?
4441
		if ( doneList.FindData(f) ) 
4452
		if (doneList.FindData(f))
4442
			continue;
4453
			continue;
4443
 
4454
 
4444
		// only do files that are enabled
4455
		// only do files that are enabled
4445
		if ( f->IsDisabled() )
4456
		if (f->IsDisabled())
4446
			continue;
4457
			continue;
4447
 
4458
 
4448
		// check if the file is a fake patch
4459
		// check if the file is a fake patch
4449
		if ( !f->IsFakePatch() )
4460
		if (!f->IsFakePatch())
4450
			continue;
4461
			continue;
4451
 
4462
 
4452
		// we only want cat and dat files, all fake patchs should be, but incase theres an error in the package somewhere we can check
4463
		// we only want cat and dat files, all fake patchs should be, but incase theres an error in the package somewhere we can check
4453
		if (!f->checkFileExt(L"cat"))
4464
		if (!f->checkFileExt(L"cat"))
4454
			continue;
4465
			continue;
4455
 
4466
 
-
 
4467
		bool added = false;
-
 
4468
		int num = f->baseName().toInt();
-
 
4469
		for (auto itr = fakepatches.begin(); itr != fakepatches.end(); itr++)
-
 
4470
		{
-
 
4471
			int checkNum = (*itr)->baseName().toInt();
-
 
4472
			if (num < checkNum)
-
 
4473
			{
-
 
4474
				fakepatches.insert(itr, f);
-
 
4475
				added = true;
-
 
4476
				break;
-
 
4477
			}
-
 
4478
		}
-
 
4479
		if (!added)
-
 
4480
			fakepatches.push_back(f);
-
 
4481
	}
-
 
4482
 
-
 
4483
	for(auto itr = fakepatches.begin(); itr != fakepatches.end(); itr++)
-
 
4484
	{
4456
		// now lets check if its greater than our gap
4485
		// now lets check if its greater than our gap
4457
		int check = findNextFakePatch();
4486
		int check = findNextFakePatch();
4458
		int patchNum = f->filename().token(L".", 1).toInt();
4487
		int patchNum = (*itr)->filename().token(L".", 1).toInt();
4459
		if ( patchNum <= check )
4488
		if ( patchNum <= check )
4460
			continue;
4489
			continue;
4461
 
4490
 
4462
		shufflePatchTo(f, check, errors);
4491
		shufflePatchTo(*itr, check, errors);
4463
	}
4492
	}
4464
}
4493
}
4465
 
4494
 
4466
void CPackages::shufflePatchTo(C_File *file, int to, Utils::WStringList *errors)
4495
void CPackages::shufflePatchTo(C_File *file, int to, Utils::WStringList *errors)
4467
{
4496
{
Line 4527... Line 4556...
4527
 
4556
 
4528
	return lowest;
4557
	return lowest;
4529
}
4558
}
4530
 
4559
 
4531
int CPackages::findLastFakePatch(int start, const Utils::WString &dir) const
4560
int CPackages::findLastFakePatch(int start, const Utils::WString &dir) const
4532
{
4561
{
4533
	CDirIO Dir((dir.empty()) ? m_sCurrentDir : dir);
4562
	CDirIO Dir((dir.empty()) ? m_sCurrentDir : dir);
4534
 
4563
 
4535
	int check = start;
4564
	int check = start;
4536
	while ( check > 0 )
4565
	while ( check > 0 )
4537
	{
4566
	{
4538
		Utils::WString checkStr = Utils::WString::PadNumber(check, 2);
4567
		Utils::WString checkStr = Utils::WString::PadNumber(check, 2);
4539
 
4568
 
4540
		// check if a cat file exists
4569
		// check if a cat file exists
4541
		if ( !Dir.exists(checkStr + L".cat") )
4570
		if ( !Dir.exists(checkStr + L".cat") )
4542
		{
4571
		{
4543
			// it doen't, check if theres a dat file (incase of package error)
4572
			// it doen't, check if theres a dat file (incase of package error)
4544
			if ( !Dir.exists(checkStr + L".dat") )
4573
			if ( !Dir.exists(checkStr + L".dat") )
4545
				break;
4574
				break;
4546
		}
4575
		}
4547
		--check;
4576
		--check;
4548
	}
4577
	}
4549
 
4578
 
4550
	return check;
4579
	return check;
4551
}
4580
}
4552
 
4581
 
4553
/**
4582
/**
4554
 * Find next fake patch
4583
 * Find next fake patch
4555
 *
4584
 *
4556
 * Searching for the next gap in patches, starting with 01.cat to 99.cat
4585
 * Searching for the next gap in patches, starting with 01.cat to 99.cat
Line 4562... Line 4591...
4562
	int check = start;
4591
	int check = start;
4563
	while ( check < 99 )
4592
	while ( check < 99 )
4564
	{
4593
	{
4565
		++check;
4594
		++check;
4566
		Utils::WString checkStr = Utils::WString::PadNumber(check, 2);
4595
		Utils::WString checkStr = Utils::WString::PadNumber(check, 2);
4567
 
4596
 
4568
		// check if a cat file exists
4597
		// check if a cat file exists
4569
		if ( !Dir.exists(checkStr + L".cat") )
4598
		if ( !Dir.exists(checkStr + L".cat") )
4570
		{
4599
		{
4571
			// it doen't, check if theres a dat file (incase of package error)
4600
			// it doen't, check if theres a dat file (incase of package error)
4572
			if ( !Dir.exists(checkStr + L".dat") )
4601
			if ( !Dir.exists(checkStr + L".dat") )
Line 4643... Line 4672...
4643
 
4672
 
4644
	// check for lang.dat file
4673
	// check for lang.dat file
4645
	if ( Dir.exists(L"lang.dat") )
4674
	if ( Dir.exists(L"lang.dat") )
4646
	{
4675
	{
4647
		CFileIO File(Dir.file(L"lang.dat"));
4676
		CFileIO File(Dir.file(L"lang.dat"));
4648
 
4677
 
4649
		size_t size;
4678
		size_t size;
4650
		char *data = File.ReadToData(&size);
4679
		char *data = File.ReadToData(&size);
4651
 
4680
 
4652
		if ( data )
4681
		if ( data )
4653
		{
4682
		{
Line 4659... Line 4688...
4659
 
4688
 
4660
/**
4689
/**
4661
 * Create Language Text File
4690
 * Create Language Text File
4662
 *
4691
 *
4663
 * Creates text files for all packages into the correct language
4692
 * Creates text files for all packages into the correct language
4664
 */
4693
 */
4665
void CPackages::CreateLanguageTextFiles(Utils::WStringList *errors)
4694
void CPackages::CreateLanguageTextFiles(Utils::WStringList *errors)
4666
{
4695
{
4667
	// no need to create them if theres no language to use
4696
	// no need to create them if theres no language to use
4668
	if ( !m_iLanguage )
4697
	if ( !m_iLanguage )
4669
		return;
4698
		return;
Line 5179... Line 5208...
5179
 
5208
 
5180
	return Utils::WString::Null();
5209
	return Utils::WString::Null();
5181
}
5210
}
5182
 
5211
 
5183
Utils::WString CPackages::getGameVersionFromType(int game, int version, const Utils::WString &sVersion) const
5212
Utils::WString CPackages::getGameVersionFromType(int game, int version, const Utils::WString &sVersion) const
5184
{
5213
{
5185
	return m_gameExe.gameVersionFromType(game - 1, version - 1, sVersion);
5214
	return m_gameExe.gameVersionFromType(game - 1, version - 1, sVersion);
5186
}
5215
}
5187
 
5216
 
5188
int CPackages::CountBuiltInPackages(bool onlyEnabled)
5217
int CPackages::CountBuiltInPackages(bool onlyEnabled)
5189
{
5218
{
5190
	int count = 0;
5219
	int count = 0;
5191
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
5220
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
5192
	{
5221
	{
Line 5194... Line 5223...
5194
			continue;
5223
			continue;
5195
		if ( onlyEnabled && !node->Data()->IsEnabled() )
5224
		if ( onlyEnabled && !node->Data()->IsEnabled() )
5196
			continue;
5225
			continue;
5197
		if ( node->Data()->author().Compare(L"PluginManager") )
5226
		if ( node->Data()->author().Compare(L"PluginManager") )
5198
			++count;
5227
			++count;
5199
	}
5228
	}
5200
 
5229
 
5201
	return count;
5230
	return count;
5202
}
5231
}
5203
 
5232
 
5204
int CPackages::countPackages(int type, bool onlyEnabled) const
5233
int CPackages::countPackages(int type, bool onlyEnabled) const
5205
{
5234
{
5206
	int count = 0;
5235
	int count = 0;
Line 5237... Line 5266...
5237
			if (!file->checkFileExt(L"cat"))
5266
			if (!file->checkFileExt(L"cat"))
5238
				continue;
5267
				continue;
5239
 
5268
 
5240
			CCatFile catFile;
5269
			CCatFile catFile;
5241
			if (catFile.open(file->filePointer(), addonDir, CATREAD_CATDECRYPT, false) == CATERR_NONE)
5270
			if (catFile.open(file->filePointer(), addonDir, CATREAD_CATDECRYPT, false) == CATERR_NONE)
5242
			{
5271
			{
5243
				if (catFile.extractFile(aFilename, aTo))
5272
				if (catFile.extractFile(aFilename, aTo))
5244
					return 1;
5273
					return 1;
5245
				if (catFile.error() == CATERR_INVALIDDEST || catFile.error() == CATERR_CANTCREATEDIR)
5274
				if (catFile.error() == CATERR_INVALIDDEST || catFile.error() == CATERR_CANTCREATEDIR)
5246
				{
5275
				{
5247
					if (catFile.extractFile(aFilename))
5276
					if (catFile.extractFile(aFilename))
5248
						return -1;
5277
						return -1;
5249
				}
5278
				}
5250
 
5279
 
5251
			}
5280
			}
5252
		}
5281
		}
5253
	}
5282
	}
5254
	else if (!m_sSetMod.empty())
5283
	else if (!m_sSetMod.empty())
Line 5277... Line 5306...
5277
	// get the last one, not the next free one
5306
	// get the last one, not the next free one
5278
	--catNumber;
5307
	--catNumber;
5279
 
5308
 
5280
	// work backwards until we find the file
5309
	// work backwards until we find the file
5281
	for (; catNumber; catNumber--)
5310
	for (; catNumber; catNumber--)
5282
	{
5311
	{
5283
		CCatFile catFile;
5312
		CCatFile catFile;
5284
		if (catFile.open((dir + L"/" + Utils::WString::PadNumber(catNumber, 2) + L".cat"), addonDir, CATREAD_CATDECRYPT, false) == CATERR_NONE)
5313
		if (catFile.open((dir + L"/" + Utils::WString::PadNumber(catNumber, 2) + L".cat"), addonDir, CATREAD_CATDECRYPT, false) == CATERR_NONE)
5285
		{
5314
		{
5286
			// check for the file
5315
			// check for the file
5287
			if (catFile.extractFile(aFilename, aTo))
5316
			if (catFile.extractFile(aFilename, aTo))
Line 5309... Line 5338...
5309
 
5338
 
5310
		// lets extract the ware file
5339
		// lets extract the ware file
5311
		wchar_t wareType = CPackages::ConvertWareTypeBack(i);
5340
		wchar_t wareType = CPackages::ConvertWareTypeBack(i);
5312
		Utils::WString wareFile = L"TWare";
5341
		Utils::WString wareFile = L"TWare";
5313
		wareFile += (wchar_t)std::toupper(wareType);
5342
		wareFile += (wchar_t)std::toupper(wareType);
5314
 
5343
 
5315
		Utils::WString openFile;
5344
		Utils::WString openFile;
5316
 
5345
 
5317
		int e;
5346
		int e;
5318
		if ( i == WARES_TECH && CFileIO::Exists(m_sTempDir + L"/TWareT.txt") )
5347
		if ( i == WARES_TECH && CFileIO::Exists(m_sTempDir + L"/TWareT.txt") )
5319
			openFile = m_sTempDir + L"/TWareT.txt";
5348
			openFile = m_sTempDir + L"/TWareT.txt";
Line 5342... Line 5371...
5342
					Utils::WString line = *itr;
5371
					Utils::WString line = *itr;
5343
					line.removeFirstSpace();
5372
					line.removeFirstSpace();
5344
					line.removeChar(9);
5373
					line.removeChar(9);
5345
					line.removeChar('\r');
5374
					line.removeChar('\r');
5346
					if ( line.empty() )
5375
					if ( line.empty() )
5347
						continue;
5376
						continue;
5348
					if ( line[0] == '/' )
5377
					if ( line[0] == '/' )
5349
						continue;
5378
						continue;
5350
 
5379
 
5351
					if ( oldSize == -1 )
5380
					if ( oldSize == -1 )
5352
					{
5381
					{
Line 5439... Line 5468...
5439
	}
5468
	}
5440
	else if (m_iGame == GAME_X3FL)
5469
	else if (m_iGame == GAME_X3FL)
5441
	{
5470
	{
5442
		if (maxsize) (*maxsize) = EMP_X3FL;
5471
		if (maxsize) (*maxsize) = EMP_X3FL;
5443
		return GetX3TCEmp();
5472
		return GetX3TCEmp();
5444
	}
5473
	}
5445
	else if ( m_iGame == GAME_X3 )
5474
	else if ( m_iGame == GAME_X3 )
5446
	{
5475
	{
5447
		if ( maxsize ) (*maxsize) = EMP_X3;
5476
		if ( maxsize ) (*maxsize) = EMP_X3;
5448
		return GetX3Emp();
5477
		return GetX3Emp();
5449
	}
5478
	}
Line 7516... Line 7545...
7516
			CFileIO WriteFile(m_sTempDir + L"/TShips.txt");
7545
			CFileIO WriteFile(m_sTempDir + L"/TShips.txt");
7517
			if ( WriteFile.writeFile(tshipsList) )
7546
			if ( WriteFile.writeFile(tshipsList) )
7518
			{
7547
			{
7519
				this->packFile(&WriteFile, L"types/TShips.pck");
7548
				this->packFile(&WriteFile, L"types/TShips.pck");
7520
				WriteFile.remove();
7549
				WriteFile.remove();
7521
			}
7550
			}
7522
		}
7551
		}
7523
	}
7552
	}
7524
}
7553
}
7525
 
7554
 
7526
bool CPackages::packFile(const Utils::WString &filename) const
7555
bool CPackages::packFile(const Utils::WString &filename) const
7527
{
7556
{
7528
	// compress the file
7557
	// compress the file
Line 7778... Line 7807...
7778
 
7807
 
7779
	return list.size();
7808
	return list.size();
7780
}
7809
}
7781
 
7810
 
7782
CBaseFile *CPackages::findScriptByAuthor(const Utils::WString &author, CBaseFile *prev)
7811
CBaseFile *CPackages::findScriptByAuthor(const Utils::WString &author, CBaseFile *prev)
7783
{
7812
{
7784
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
7813
	for ( CListNode<CBaseFile> *node = m_lPackages.Front(); node; node = node->next() )
7785
	{
7814
	{
7786
		CBaseFile *p = node->Data();
7815
		CBaseFile *p = node->Data();
7787
		if ( prev )
7816
		if ( prev )
7788
		{
7817
		{
Line 7791... Line 7820...
7791
			continue;
7820
			continue;
7792
		}
7821
		}
7793
		if ( p->author().Compare(author) )
7822
		if ( p->author().Compare(author) )
7794
			return p;
7823
			return p;
7795
	}
7824
	}
7796
 
7825
 
7797
	return NULL;
7826
	return NULL;
7798
}
7827
}
7799
 
7828
 
7800
bool CPackages::extractAll(CBaseFile *baseFile, const Utils::WString &dir, int game, bool includedir, CProgressInfo *progress) const
7829
bool CPackages::extractAll(CBaseFile *baseFile, const Utils::WString &dir, int game, bool includedir, CProgressInfo *progress) const
7801
{
7830
{
7802
	if (!baseFile)
7831
	if (!baseFile)
7803
		return false;
7832
		return false;
7804
 
7833
 
Line 7809... Line 7838...
7809
		if (!exe->sAddon.empty())
7838
		if (!exe->sAddon.empty())
7810
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7839
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7811
	}
7840
	}
7812
 
7841
 
7813
	return baseFile->extractAll(dir, game, gameAddons, includedir, progress);
7842
	return baseFile->extractAll(dir, game, gameAddons, includedir, progress);
7814
}
7843
}
7815
 
7844
 
7816
bool CPackages::generatePackagerScript(CBaseFile *baseFile, bool wildcard, Utils::WStringList *list, int game, bool datafile) const
7845
bool CPackages::generatePackagerScript(CBaseFile *baseFile, bool wildcard, Utils::WStringList *list, int game, bool datafile) const
7817
{	
7846
{	
7818
	if (!baseFile)
7847
	if (!baseFile)
7819
		return false;
7848
		return false;
7820
 
7849
 
Line 7825... Line 7854...
7825
		if (!exe->sAddon.empty())
7854
		if (!exe->sAddon.empty())
7826
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7855
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7827
	}
7856
	}
7828
 
7857
 
7829
	return baseFile->GeneratePackagerScript(wildcard, list, game, gameAddons, datafile);
7858
	return baseFile->GeneratePackagerScript(wildcard, list, game, gameAddons, datafile);
7830
}
7859
}
7831
 
7860
 
7832
CBaseFile *CPackages::loadPackagerScript(const Utils::WString &filename, int compression, Utils::WString (*askFunc)(const Utils::WString &), Utils::WStringList *malformedLines, Utils::WStringList *unknownCommands, Utils::WStringList *variables, CProgressInfo *progress)
7861
CBaseFile *CPackages::loadPackagerScript(const Utils::WString &filename, int compression, Utils::WString (*askFunc)(const Utils::WString &), Utils::WStringList *malformedLines, Utils::WStringList *unknownCommands, Utils::WStringList *variables, CProgressInfo *progress)
7833
{
7862
{
7834
	// check the file exists
7863
	// check the file exists
7835
	if ( !CFileIO::Exists(filename) )
7864
	if ( !CFileIO::Exists(filename) )
7836
		return NULL;
7865
		return NULL;
Line 7858... Line 7887...
7858
 
7887
 
7859
		// check for any comments (so we can ignore them)
7888
		// check for any comments (so we can ignore them)
7860
		if ( line.left(2).Compare(L"//") || line[0] == L'#' ) continue;
7889
		if ( line.left(2).Compare(L"//") || line[0] == L'#' ) continue;
7861
 
7890
 
7862
		++iLine;
7891
		++iLine;
7863
 
7892
 
7864
		// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
7893
		// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
7865
		if ( !line.contains(L':') )
7894
		if ( !line.contains(L':') )
7866
		{
7895
		{
7867
			// there are some exeptions, and these are one word entrys only
7896
			// there are some exeptions, and these are one word entrys only
7868
			line.removeEndSpace();
7897
			line.removeEndSpace();
Line 7907... Line 7936...
7907
	for (unsigned int i = 0; i < m_gameExe.gameCount(); ++i)
7936
	for (unsigned int i = 0; i < m_gameExe.gameCount(); ++i)
7908
	{
7937
	{
7909
		SGameExe *exe = m_gameExe.game(i);
7938
		SGameExe *exe = m_gameExe.game(i);
7910
		if (!exe->sAddon.empty())
7939
		if (!exe->sAddon.empty())
7911
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7940
			gameAddons.pushBack(Utils::WString::Number(i + 1), exe->sAddon);
7912
	}
7941
	}
7913
 
7942
 
7914
	// now lets read the rest of the day
7943
	// now lets read the rest of the day
7915
	Utils::WStringList listVaribles;
7944
	Utils::WStringList listVaribles;
7916
	for (Utils::WStringNode *line = fileData.first(); line; line = fileData.next())
7945
	for (Utils::WStringNode *line = fileData.first(); line; line = fileData.next())
7917
	{
7946
	{
7918
		Utils::WString cmd = line->str.token(L":", 1);
7947
		Utils::WString cmd = line->str.token(L":", 1);
Line 8297... Line 8326...
8297
 
8326
 
8298
	return false;
8327
	return false;
8299
}
8328
}
8300
 
8329
 
8301
size_t CPackages::loadShipData(const Utils::WString &file, Utils::WStringList &list) const
8330
size_t CPackages::loadShipData(const Utils::WString &file, Utils::WStringList &list) const
8302
{
8331
{
8303
	CFileIO File;
8332
	CFileIO File;
8304
	bool deleteFile = false;
8333
	bool deleteFile = false;
8305
 
8334
 
8306
	// load from cat file
8335
	// load from cat file
8307
	if (CFileIO(file).isFileExtension(L"cat"))
8336
	if (CFileIO(file).isFileExtension(L"cat"))
8308
	{
8337
	{
Line 8558... Line 8587...
8558
		return FILETYPE_SOUND;
8587
		return FILETYPE_SOUND;
8559
	return filetype;
8588
	return filetype;
8560
}
8589
}
8561
 
8590
 
8562
void CPackages::RemoveFailedFiles()
8591
void CPackages::RemoveFailedFiles()
8563
{
8592
{
8564
	Utils::WStringList removed;
8593
	Utils::WStringList removed;
8565
	for (auto itr = _lNonRemovedFiles.begin(); itr != _lNonRemovedFiles.end(); itr++)
8594
	for (auto itr = _lNonRemovedFiles.begin(); itr != _lNonRemovedFiles.end(); itr++)
8566
	{
8595
	{
8567
		if (CFileIO::Remove((*itr)->str))
8596
		if (CFileIO::Remove((*itr)->str))
8568
			removed.pushBack((*itr)->str);
8597
			removed.pushBack((*itr)->str);
Line 8687... Line 8716...
8687
//	Utils::WStringList *text = this->MergeTextFiles(conflicts, mod1, mod2);
8716
//	Utils::WStringList *text = this->MergeTextFiles(conflicts, mod1, mod2);
8688
//	delete text;
8717
//	delete text;
8689
 
8718
 
8690
	// write the cat file when we're done
8719
	// write the cat file when we're done
8691
	if ( !newCat.WriteCatFile() )
8720
	if ( !newCat.WriteCatFile() )
8692
		return false;
8721
		return false;
8693
 
8722
 
8694
	return true;
8723
	return true;
8695
}
8724
}
8696
 
8725
 
8697
/**
8726
/**
8698
 * Gets the file list from a mod that might have compatability problems
8727
 * Gets the file list from a mod that might have compatability problems
Line 9337... Line 9366...
9337
 
9366
 
9338
			// check for any comments
9367
			// check for any comments
9339
			if ( linenospace.left(2) == L"//" )
9368
			if ( linenospace.left(2) == L"//" )
9340
				continue;
9369
				continue;
9341
			if ( linenospace[0] == L'#' )
9370
			if ( linenospace[0] == L'#' )
9342
				continue;
9371
				continue;
9343
 
9372
 
9344
			// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
9373
			// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
9345
			if ( !line.contains(':'))
9374
			if ( !line.contains(':'))
9346
				continue;
9375
				continue;
9347
 
9376
 
9348
			Utils::WString first = line.token(L":", 1);
9377
			Utils::WString first = line.token(L":", 1);
Line 9487... Line 9516...
9487
#endif
9516
#endif
9488
 
9517
 
9489
	return archive;
9518
	return archive;
9490
}
9519
}
9491
 
9520
 
-
 
9521
bool CPackages::_check_archive_fromZip(const Utils::WString& filename) const
-
 
9522
{
-
 
9523
	HZIP hz = OpenZip(filename.c_str(), 0);
-
 
9524
	if (!hz)
-
 
9525
		return false;
-
 
9526
 
-
 
9527
	bool found = false;
-
 
9528
 
-
 
9529
	int index;
-
 
9530
	// move the files from the zip to the package
-
 
9531
	ZIPENTRY ze;
-
 
9532
	if (FindZipItem(hz, L"pluginmanager.txt", true, &index, &ze) == Z_OK)
-
 
9533
		found = true;
-
 
9534
	CloseZip(hz);
-
 
9535
 
-
 
9536
	return found;
-
 
9537
}
-
 
9538
 
9492
CBaseFile *CPackages::_archive_fromZip(const Utils::WString &filename, bool toInstall) const
9539
CBaseFile* CPackages::_archive_fromZip(const Utils::WString& filename, bool toInstall) const
9493
{
9540
{
9494
	CBaseFile *archive = NULL;
9541
	CBaseFile *archive = NULL;
9495
 
9542
 
9496
	HZIP hz = OpenZip(filename.c_str(), 0);
9543
	HZIP hz = OpenZip(filename.c_str(), 0);
9497
	if ( !hz ) 
9544
	if ( !hz ) 
Line 9557... Line 9604...
9557
				f = archive->addFile(filename, dir, FILETYPE_SCRIPT);
9604
				f = archive->addFile(filename, dir, FILETYPE_SCRIPT);
9558
				if ( f ) {
9605
				if ( f ) {
9559
					f->copyData((const unsigned char *)iBuf, ze.unc_size);
9606
					f->copyData((const unsigned char *)iBuf, ze.unc_size);
9560
				}
9607
				}
9561
				type = FILETYPE_UNINSTALL;
9608
				type = FILETYPE_UNINSTALL;
9562
			}
9609
			}
9563
 
9610
 
9564
			int game = 0;
9611
			int game = 0;
9565
			// check for addons
9612
			// check for addons
9566
			if (dir.contains('/', true)) 
9613
			if (dir.contains('/', true)) 
9567
			{
9614
			{
Line 9571... Line 9618...
9571
					game = g + 1;
9618
					game = g + 1;
9572
			}
9619
			}
9573
 
9620
 
9574
			if ( type == -1 )
9621
			if ( type == -1 )
9575
				f = archive->addFile(filename, dir, FILETYPE_EXTRA, game);
9622
				f = archive->addFile(filename, dir, FILETYPE_EXTRA, game);
9576
			else
9623
			else
9577
				f = archive->addFile(filename, extradir, static_cast<FileType>(type), game);
9624
				f = archive->addFile(filename, extradir, static_cast<FileType>(type), game);
9578
 
9625
 
9579
			if ( f )
9626
			if ( f )
9580
				f->SetData((const unsigned char *)iBuf, ze.unc_size);
9627
				f->SetData((const unsigned char *)iBuf, ze.unc_size);
9581
			else
9628
			else
Line 9599... Line 9646...
9599
	CBaseFile *archive = NULL;
9646
	CBaseFile *archive = NULL;
9600
	if ( CFileIO(filename).isFileExtension(L"rar") )
9647
	if ( CFileIO(filename).isFileExtension(L"rar") )
9601
		archive = this->_archive_fromRar(filename, toInstall);
9648
		archive = this->_archive_fromRar(filename, toInstall);
9602
	else if ( CFileIO(filename).isFileExtension(L"zip") )
9649
	else if ( CFileIO(filename).isFileExtension(L"zip") )
9603
		archive = this->_archive_fromZip(filename, toInstall);
9650
		archive = this->_archive_fromZip(filename, toInstall);
-
 
9651
	else
-
 
9652
		archive = this->_archive_fromZip(filename, false);
9604
 
9653
 
9605
	if ( archive ) {
9654
	if ( archive ) {
9606
		archive->setFilename(CFileIO(filename).changeFileExtension(L"spk"));
9655
		archive->setFilename(CFileIO(filename).changeFileExtension(L"spk"));
9607
		if ( toInstall )
9656
		if ( toInstall )
9608
			archive->setName(CFileIO(filename).filename());
9657
			archive->setName(CFileIO(filename).filename());