Subversion Repositories spk

Rev

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

Rev 96 Rev 98
Line 1201... Line 1201...
1201
		// change file pointer
1201
		// change file pointer
1202
		Utils::String sFilename = _install_adjustFilepointer(fit, fileEnabled, destdir.ToString());
1202
		Utils::String sFilename = _install_adjustFilepointer(fit, fileEnabled, destdir.ToString());
1203
 
1203
 
1204
		C_File *adjustPointer = NULL;
1204
		C_File *adjustPointer = NULL;
1205
 
1205
 
1206
		bool checkFile = dofile;
-
 
1207
		if ( filelist ) {
1206
		if ( filelist ) {
1208
			C_File *cFile = (checkFile) ? _install_checkFile(fit, errorStr, &dofile, filelist) : NULL;
1207
			C_File *cFile = _install_checkFile(fit, errorStr, &dofile, filelist);
1209
 
1208
 
1210
			// no matching file found, adding to main list
1209
			// no matching file found, adding to main list
1211
			if ( !cFile ) filelist->push_back ( fit );
1210
			if ( !cFile ) filelist->push_back ( fit );
1212
			else
1211
			else
1213
			{
1212
			{
Line 2573... Line 2572...
2573
	else
2572
	else
2574
		Found->iVersion = version;
2573
		Found->iVersion = version;
2575
	_changed();
2574
	_changed();
2576
}
2575
}
2577
 
2576
 
2578
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest)
2577
bool CBaseFile::LoadPackageData(const Utils::String &sFirst, const Utils::String &sRest, const Utils::String &sMainGame, Utils::CStringList &otherGames)
2579
{
2578
{
2580
	if ( sFirst.Compare("Name") )					this->setName(sRest);
2579
	if ( sFirst.Compare("Name") )					this->setName(sRest);
2581
	else if ( sFirst.Compare("Author") )			this->setAuthor(sRest);
2580
	else if ( sFirst.Compare("Author") )			this->setAuthor(sRest);
2582
	else if ( sFirst.Compare("ScriptName") )
2581
	else if ( sFirst.Compare("ScriptName") )
2583
		AddLanguageName(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
2582
		AddLanguageName(ParseLanguage(sRest.token(" ", 1)), sRest.tokens(" ", 2));
Line 2681... Line 2680...
2681
		}
2680
		}
2682
 
2681
 
2683
		// now check type name
2682
		// now check type name
2684
		int filetype = GetFileTypeFromString(checkType);
2683
		int filetype = GetFileTypeFromString(checkType);
2685
		if ( filetype != -1 )
2684
		if ( filetype != -1 )
2686
			this->AddFileScript(filetype, shared, sRest);
2685
			this->AddFileScript(filetype, shared, sRest, sMainGame, otherGames);
2687
		else if ( !checkType.Compare("changelog") )
2686
		else if ( !checkType.Compare("changelog") )
2688
			return false;
2687
			return false;
2689
	}
2688
	}
2690
 
2689
 
2691
	return true;
2690
	return true;
2692
}
2691
}
2693
 
2692
 
2694
void CBaseFile::AddFileScript(int filetype, bool shared, CyString rest)
2693
void CBaseFile::AddFileScript(int filetype, bool shared, CyString rest, const Utils::String &sMainGame, Utils::CStringList &otherGames)
2695
{
2694
{
2696
	CyString dir;
2695
	CyString dir;
2697
	if ( rest.IsIn("|") )
2696
	if ( rest.IsIn("|") )
2698
	{
2697
	{
2699
		dir = rest.GetToken("|", 2);
2698
		dir = rest.GetToken("|", 2);
2700
		rest = rest.GetToken("|", 1, 1);
2699
		rest = rest.GetToken("|", 1, 1);
2701
	}
2700
	}
2702
 
2701
 
-
 
2702
	int mainGame = CBaseFile::GetGameFromString(sMainGame);
-
 
2703
 
2703
	int game = 0;
2704
	int game = 0;
2704
	if ( rest.GetToken(" ", 1, 1).Left(4).Compare("GAME") ) {
2705
	if ( rest.GetToken(" ", 1, 1).Left(4).Compare("GAME") ) {
2705
		game = CBaseFile::GetGameFromString(rest.GetToken(" ", 2, 2).ToString());
2706
		game = CBaseFile::GetGameFromString(rest.GetToken(" ", 2, 2).ToString());
2706
		rest = rest.GetToken(" ", 3);
2707
		rest = rest.GetToken(" ", 3);
2707
	}
2708
	}
Line 2718... Line 2719...
2718
			for ( SStringList *strNode = dirList->Head(); strNode; strNode = strNode->next )
2719
			for ( SStringList *strNode = dirList->Head(); strNode; strNode = strNode->next )
2719
			{
2720
			{
2720
				CyString file = Dir.File(strNode->str);
2721
				CyString file = Dir.File(strNode->str);
2721
				if ( file.WildMatch(rest) )
2722
				if ( file.WildMatch(rest) )
2722
				{
2723
				{
-
 
2724
					int addGame = game;
-
 
2725
					// check if the file exists in the subdirectory too, if it does, add for each game
-
 
2726
					if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
-
 
2727
						CFileIO F(file);
-
 
2728
						for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
-
 
2729
							Utils::String checkDir = F.GetDir().ToString() + "/" + g;
-
 
2730
							if ( CDirIO(checkDir).Exists(F.filename()) ) {
-
 
2731
								addGame = mainGame;
-
 
2732
								C_File *newfile = this->AppendFile(CDirIO(checkDir).File(F.filename()), filetype, CBaseFile::GetGameFromString(g), dir);
-
 
2733
								if ( newfile ) newfile->SetShared(shared);
-
 
2734
							}
-
 
2735
						}
-
 
2736
					}
-
 
2737
 
2723
					C_File *newfile = this->AppendFile(file, filetype, game, dir);
2738
					C_File *newfile = this->AppendFile(file, filetype, addGame, dir);
2724
					if ( newfile )
2739
					if ( newfile )
2725
						newfile->SetShared(shared);
2740
						newfile->SetShared(shared);
2726
				}
2741
				}
2727
			}
2742
			}
2728
			delete dirList;
2743
			delete dirList;
2729
		}
2744
		}
2730
	}
2745
	}
2731
	else
2746
	else
2732
	{
2747
	{
-
 
2748
		int addGame = game;
-
 
2749
		// check if the file exists in the subdirectory too, if it does, add for each game
-
 
2750
		if ( game == GAME_ALL && !sMainGame.empty() && !otherGames.empty() ) {
-
 
2751
			CFileIO F(rest);
-
 
2752
			for(Utils::String g = otherGames.firstString(); !g.empty(); g = otherGames.nextString()) {
-
 
2753
				Utils::String checkDir = F.GetDir().ToString() + "/" + g;
-
 
2754
				if ( CDirIO(checkDir).Exists(F.filename()) ) {
-
 
2755
					addGame = mainGame;
-
 
2756
					C_File *newfile = this->AppendFile(CDirIO(checkDir).File(F.filename()), filetype, CBaseFile::GetGameFromString(g), dir);
-
 
2757
					if ( newfile ) newfile->SetShared(shared);
-
 
2758
				}
-
 
2759
			}
-
 
2760
		}
-
 
2761
 
2733
		C_File *file = this->AppendFile(rest, filetype, game, dir);
2762
		C_File *file = this->AppendFile(rest, filetype, addGame, dir);
2734
		if ( file )
2763
		if ( file )
2735
			file->SetShared(shared);
2764
			file->SetShared(shared);
2736
	}
2765
	}
2737
}
2766
}
2738
 
2767