Subversion Repositories spk

Rev

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

Rev 130 Rev 131
Line 7507... Line 7507...
7507
	}
7507
	}
7508
 
7508
 
7509
	return baseFile->GeneratePackagerScript(wildcard, list, game, gameAddons, datafile);
7509
	return baseFile->GeneratePackagerScript(wildcard, list, game, gameAddons, datafile);
7510
}
7510
}
7511
 
7511
 
7512
CBaseFile *CPackages::LoadPackagerScript(CyString filename, int compression, Utils::String (*askFunc)(const Utils::String &), CyStringList *malformedLines, CyStringList *unknownCommands, CyStringList *variables)
7512
CBaseFile *CPackages::LoadPackagerScript(const Utils::String &filename, int compression, Utils::String (*askFunc)(const Utils::String &), Utils::CStringList *malformedLines, Utils::CStringList *unknownCommands, Utils::CStringList *variables)
7513
{
7513
{
7514
	// check the file exists
7514
	// check the file exists
7515
	if ( !CFileIO::Exists(filename.ToString()) )
7515
	if ( !CFileIO::Exists(filename) )
7516
		return NULL;
7516
		return NULL;
7517
 
7517
 
7518
	// read all the lines
7518
	// read all the lines
7519
	CFileIO File(filename);
7519
	CFileIO File(filename);
7520
	if ( !File.startRead() ) 
7520
	if ( !File.startRead() ) 
Line 7540... Line 7540...
7540
		if ( line.left(2).Compare("//") || line[0] == '#' ) continue;
7540
		if ( line.left(2).Compare("//") || line[0] == '#' ) continue;
7541
 
7541
 
7542
		++iLine;
7542
		++iLine;
7543
 
7543
 
7544
		// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
7544
		// all commands start with a keyword followed by a colon, if one doesn't exist, it cant be a valid line
7545
		if ( !line.isin(':') )
7545
		if ( !line.contains(':') )
7546
		{
7546
		{
7547
			// there are some exeptions, and these are one word entrys only
7547
			// there are some exeptions, and these are one word entrys only
7548
			line.removeEndSpace();
7548
			line.removeEndSpace();
7549
			if ( line.isin(" ") )
7549
			if ( line.contains(" ") )
7550
			{
7550
			{
7551
				if ( malformedLines )
7551
				if ( malformedLines )
7552
					malformedLines->PushBack(CyString(line), CyString::Number(iLine));
7552
					malformedLines->pushBack(line, Utils::String::Number(iLine));
7553
				continue;
7553
				continue;
7554
			}
7554
			}
7555
		}
7555
		}
7556
 
7556
 
7557
		// check for the type line
7557
		// check for the type line
Line 7590... Line 7590...
7590
		if (!exe->sAddon.empty())
7590
		if (!exe->sAddon.empty())
7591
			gameAddons.pushBack(Utils::String::Number(i + 1), exe->sAddon);
7591
			gameAddons.pushBack(Utils::String::Number(i + 1), exe->sAddon);
7592
	}
7592
	}
7593
 
7593
 
7594
	// now lets read the rest of the day
7594
	// now lets read the rest of the day
7595
	CyStringList listVaribles;
7595
	Utils::CStringList listVaribles;
7596
	for ( Utils::SStringList *line = fileData.first(); line; line = fileData.next() )
7596
	for (Utils::SStringList *line = fileData.first(); line; line = fileData.next())
7597
	{
7597
	{
7598
		Utils::String cmd = line->str.token(":", 1);
7598
		Utils::String cmd = line->str.token(":", 1);
7599
		Utils::String rest = line->str.tokens(":", 2).removeFirstSpace();
7599
		Utils::String rest = line->str.tokens(":", 2).removeFirstSpace();
7600
 
7600
 
7601
		if ( cmd.Compare("Varible") || cmd.Compare(";Variable") )
7601
		if (cmd.Compare("Varible") || cmd.Compare(";Variable"))
-
 
7602
		{
-
 
7603
			Utils::String s1 = rest.token(" ", 1);
7602
			listVaribles.PushBack(CyString(rest.token(" ", 1)), CyString(rest.tokens(" ", 2)), true);
7604
			Utils::String s2 = rest.tokens(" ", 2);
-
 
7605
			if(!listVaribles.changeData(s1, s2))
-
 
7606
				listVaribles.pushBack(s1, s2);
-
 
7607
		}
7603
		else
7608
		else
7604
		{
7609
		{
7605
			// replace variables
7610
			// replace variables
7606
			if ( rest.isin("$") )
7611
			if ( rest.isin("$") )
7607
			{
7612
			{
7608
				for ( SStringList *strVar = listVaribles.Head(); strVar; strVar = strVar->next )
7613
				for (Utils::SStringList *strVar = listVaribles.first(); strVar; strVar = listVaribles.next())
7609
				{
7614
				{
7610
					if ( rest.isin(strVar->str.ToString()) )
7615
					if ( rest.contains(strVar->str) )
7611
						rest = rest.findReplace(strVar->str.ToString(), strVar->data.ToString());
7616
						rest = rest.findReplace(strVar->str, strVar->data);
7612
				}
7617
				}
7613
 
7618
 
7614
				if ( variables )
7619
				if ( variables )
7615
				{
7620
				{
7616
					for ( SStringList *strVar = variables->Head(); strVar; strVar = strVar->next )
7621
					for (Utils::SStringList *strVar = variables->first(); strVar; strVar = variables->next())
7617
					{
7622
					{
7618
						if ( rest.isin(strVar->str.ToString()) )
7623
						if ( rest.contains(strVar->str) )
7619
							rest = rest.findReplace(strVar->str.ToString(), strVar->data.ToString());
7624
							rest = rest.findReplace(strVar->str, strVar->data);
7620
					}
7625
					}
7621
				}
7626
				}
7622
			}
7627
			}
7623
 
7628
 
7624
			//check for the built in varibles
7629
			//check for the built in varibles
Line 7680... Line 7685...
7680
				otherGames.tokenise(rest.tokens(" ", 2), " ");
7685
				otherGames.tokenise(rest.tokens(" ", 2), " ");
7681
			}
7686
			}
7682
			else if ( !package->LoadPackageData(cmd, rest, sMainGame, otherGames, gameAddons) )
7687
			else if ( !package->LoadPackageData(cmd, rest, sMainGame, otherGames, gameAddons) )
7683
			{
7688
			{
7684
				if ( unknownCommands )
7689
				if ( unknownCommands )
7685
					unknownCommands->PushBack(CyString(cmd), CyString(rest));
7690
					unknownCommands->pushBack(cmd, rest);
7686
			}
7691
			}
7687
		}
7692
		}
7688
	}
7693
	}
7689
 
7694
 
7690
	if ( package->filename().empty() )
7695
	if ( package->filename().empty() )
7691
		package->LoadPackageData("AutoSave", "$AUTOSAVE", sMainGame, otherGames, gameAddons);
7696
		package->LoadPackageData("AutoSave", "$AUTOSAVE", sMainGame, otherGames, gameAddons);
-
 
7697
 
-
 
7698
	if (package->autoExtraction())
-
 
7699
	{
-
 
7700
		for (auto itr = package->autoExtraction()->begin(); itr != package->autoExtraction()->end(); itr++)
-
 
7701
		{
-
 
7702
			unsigned int game = itr->first;
-
 
7703
			for (auto node = package->fileList()->Front(); node; node = node->next())
-
 
7704
			{
-
 
7705
				C_File *f = node->Data();
-
 
7706
				if (f->game() && f->game() != GAME_ALLNEW && !(f->game() & (1 << game)))
-
 
7707
					continue;
-
 
7708
				package->extractFile(f, itr->second, game, gameAddons);
-
 
7709
			}
-
 
7710
		}
-
 
7711
	}
-
 
7712
 
-
 
7713
	if (package->autoExporter())
-
 
7714
	{
-
 
7715
		for (auto itr = package->autoExporter()->begin(); itr != package->autoExporter()->end(); itr++)
-
 
7716
			package->saveToArchive(itr->second, itr->first, &m_gameExe);
-
 
7717
	}
7692
 
7718
 
7693
	if ( !ftpaddr.Empty() )
7719
	if ( !ftpaddr.Empty() )
7694
	{
7720
	{
7695
		if ( !ftpuser.Empty() )
7721
		if ( !ftpuser.Empty() )
7696
		{
7722
		{
Line 7710... Line 7736...
7710
}
7736
}
7711
 
7737
 
7712
CyString CPackages::GetLanguageName() const
7738
CyString CPackages::GetLanguageName() const
7713
{
7739
{
7714
	return CPackages::ConvertLanguage(m_iLanguage);
7740
	return CPackages::ConvertLanguage(m_iLanguage);
7715
}
7741
}
7716
 
7742
 
7717
Utils::String CPackages::ConvertLanguage(int lang)
7743
Utils::String CPackages::ConvertLanguage(int lang)
7718
{
7744
{
7719
	switch ( lang )
7745
	switch ( lang )
7720
	{
7746
	{
7721
		case 44:
7747
		case 44:
Line 7773... Line 7799...
7773
		// if we cant remove it, we dont have enough rights
7799
		// if we cant remove it, we dont have enough rights
7774
		if ( !File.remove() )
7800
		if ( !File.remove() )
7775
			return false;
7801
			return false;
7776
 
7802
 
7777
		// if its still there, we dont have enough rights
7803
		// if its still there, we dont have enough rights
7778
		if ( File.exists() )
7804
		if ( File.exists() )
7779
			return false;
7805
			return false;
7780
	}
7806
	}
7781
 
7807
 
7782
	// now create the file
7808
	// now create the file
7783
	if ( !File.writeString("testing access rights") )
7809
	if ( !File.writeString("testing access rights") )
7784
		return false;
7810
		return false;
7785
 
7811
 
7786
	// now check it exists
7812
	// now check it exists
7787
	if ( !File.exists() )
7813
	if ( !File.exists() )
7788
		return false;
7814
		return false;
7789
 
7815
 
7790
	// now read the file for the correct contents
7816
	// now read the file for the correct contents
7791
	CyStringList *lines = File.ReadLinesStr();
7817
	CyStringList *lines = File.ReadLinesStr();
7792
	if ( !lines )
7818
	if ( !lines )
7793
		return false;
7819
		return false;
7794
 
7820
 
Line 7797... Line 7823...
7797
	{
7823
	{
7798
		if ( s->str == "testing access rights" )
7824
		if ( s->str == "testing access rights" )
7799
		{
7825
		{
7800
			delete lines;
7826
			delete lines;
7801
			return true;
7827
			return true;
7802
		}
7828
		}
7803
	}
7829
	}
7804
 
7830
 
7805
	delete lines;
7831
	delete lines;
7806
 
7832
 
7807
	return false;
7833
	return false;
Line 7809... Line 7835...
7809
 
7835
 
7810
bool CPackages::LoadShipData(CyString file, CyStringList *list)
7836
bool CPackages::LoadShipData(CyString file, CyStringList *list)
7811
{
7837
{
7812
	CFileIO File;
7838
	CFileIO File;
7813
	bool deleteFile = false;
7839
	bool deleteFile = false;
7814
 
7840
 
7815
	// load from cat file
7841
	// load from cat file
7816
	if ( CFileIO(file).CheckFileExtension("cat") )
7842
	if ( CFileIO(file).CheckFileExtension("cat") )
7817
	{
7843
	{
7818
		CCatFile cat;
7844
		CCatFile cat;
7819
		if ( cat.open(file.ToString(), this->getAddonDir(), CATREAD_CATDECRYPT, false) != CATERR_NONE )
7845
		if ( cat.open(file.ToString(), this->getAddonDir(), CATREAD_CATDECRYPT, false) != CATERR_NONE )
7820
			return false;
7846
			return false;
7821
 
7847
 
7822
		if ( !cat.ExtractFile("types\\TShips.pck", m_sTempDir + "/tships.txt") )
7848
		if ( !cat.ExtractFile("types\\TShips.pck", m_sTempDir + "/tships.txt") )
7823
			return false;
7849
			return false;
7824
 
7850
 
7825
		File.open(m_sTempDir + "/tships.txt");
7851
		File.open(m_sTempDir + "/tships.txt");
7826
		deleteFile = true;
7852
		deleteFile = true;
7827
	}
7853
	}
7828
	// otherwise its a normal file
7854
	// otherwise its a normal file
Line 7859... Line 7885...
7859
			str->str.RemoveChar(9);
7885
			str->str.RemoveChar(9);
7860
			str->str.RemoveFirstSpace();
7886
			str->str.RemoveFirstSpace();
7861
			if ( str->str.Empty() )
7887
			if ( str->str.Empty() )
7862
				continue;
7888
				continue;
7863
			if ( str->str[0] == '/' || str->str[0] == '#' )
7889
			if ( str->str[0] == '/' || str->str[0] == '#' )
7864
				continue;
7890
				continue;
7865
 
7891
 
7866
			if ( !readFirst )
7892
			if ( !readFirst )
7867
				readFirst = true;
7893
				readFirst = true;
7868
			else
7894
			else
7869
			{
7895
			{
7870
				CyString t = str->str.GetToken(";", -2);
7896
				CyString t = str->str.GetToken(";", -2);
Line 7903... Line 7929...
7903
	delete list;
7929
	delete list;
7904
	return NullString;
7930
	return NullString;
7905
}
7931
}
7906
 
7932
 
7907
CyStringList *CPackages::LoadShipData(CyString file)
7933
CyStringList *CPackages::LoadShipData(CyString file)
7908
{
7934
{
7909
	CyStringList *list = new CyStringList;
7935
	CyStringList *list = new CyStringList;
7910
	if ( this->LoadShipData(file, list) )
7936
	if ( this->LoadShipData(file, list) )
7911
		return list;
7937
		return list;
7912
 
7938
 
7913
	delete list;
7939
	delete list;
Line 7945... Line 7971...
7945
				lang = baseFile.Right(3).ToInt();
7971
				lang = baseFile.Right(3).ToInt();
7946
			else
7972
			else
7947
			{
7973
			{
7948
				baseFile.Truncate((int)baseFile.Length() - 4);
7974
				baseFile.Truncate((int)baseFile.Length() - 4);
7949
				lang = baseFile.ToInt();
7975
				lang = baseFile.ToInt();
7950
			}
7976
			}
7951
 
7977
 
7952
			if ( lang != m_iLanguage )
7978
			if ( lang != m_iLanguage )
7953
				continue;
7979
				continue;
7954
 
7980
 
7955
			// now extract and parse
7981
			// now extract and parse
Line 7965... Line 7991...
7965
	// otherwise its a normal file
7991
	// otherwise its a normal file
7966
	else if ( CFileIO(file).CheckFileExtension("pck") )
7992
	else if ( CFileIO(file).CheckFileExtension("pck") )
7967
	{
7993
	{
7968
		C_File f(file.ToString());
7994
		C_File f(file.ToString());
7969
		if ( !f.ReadFromFile() )
7995
		if ( !f.ReadFromFile() )
7970
			return false;
7996
			return false;
7971
		f.UnPCKFile();
7997
		f.UnPCKFile();
7972
 
7998
 
7973
		f.SetFilename(m_sTempDir + "/textfile.xml");
7999
		f.SetFilename(m_sTempDir + "/textfile.xml");
7974
		if ( !f.writeFilePointer() )
8000
		if ( !f.writeFilePointer() )
7975
			return false;
8001
			return false;
Line 8007... Line 8033...
8007
						if ( p.Length() > 4 )
8033
						if ( p.Length() > 4 )
8008
							p = p.Right(4);
8034
							p = p.Right(4);
8009
						int checkPage = p.ToInt();
8035
						int checkPage = p.ToInt();
8010
						if ( checkPage == page )
8036
						if ( checkPage == page )
8011
							inPage = true;
8037
							inPage = true;
8012
					}
8038
					}
8013
				}
8039
				}
8014
			}
8040
			}
8015
 
8041
 
8016
		}
8042
		}
8017
		// add each id
8043
		// add each id
Line 8047... Line 8073...
8047
						}
8073
						}
8048
					}
8074
					}
8049
				}
8075
				}
8050
			}
8076
			}
8051
		}
8077
		}
8052
	}
8078
	}
8053
 
8079
 
8054
	delete lines;
8080
	delete lines;
8055
 
8081
 
8056
	return true;
8082
	return true;
8057
}
8083
}
8058
 
8084
 
8059
CyStringList *CPackages::ReadTextPage(CyString file, bool search, int page)
8085
CyStringList *CPackages::ReadTextPage(CyString file, bool search, int page)
Line 8091... Line 8117...
8091
		return FILETYPE_SOUND;
8117
		return FILETYPE_SOUND;
8092
	return filetype;
8118
	return filetype;
8093
}
8119
}
8094
 
8120
 
8095
void CPackages::RemoveFailedFiles()
8121
void CPackages::RemoveFailedFiles()
8096
{
8122
{
8097
	for ( SStringList *str = m_lNonRemovedFiles.Head(); str; str = str->next )
8123
	for ( SStringList *str = m_lNonRemovedFiles.Head(); str; str = str->next )
8098
	{
8124
	{
8099
		if ( CFileIO::Remove(str->str.ToString()) )
8125
		if ( CFileIO::Remove(str->str.ToString()) )
8100
			str->remove = true;
8126
			str->remove = true;
8101
	}
8127
	}
8102
 
8128
 
8103
	m_lNonRemovedFiles.RemoveMarked();
8129
	m_lNonRemovedFiles.RemoveMarked();
8104
}
8130
}
8105
 
8131
 
8106
CXspFile *CPackages::extractShip(const Utils::String &sCatFile, const Utils::String &sId, CProgressInfo *progress)
8132
CXspFile *CPackages::extractShip(const Utils::String &sCatFile, const Utils::String &sId, CProgressInfo *progress)
8107
{
8133
{
8108
	CVirtualFileSystem *pVfs = new CVirtualFileSystem();
8134
	CVirtualFileSystem *pVfs = new CVirtualFileSystem();
8109
	if ( !pVfs->addMod(sCatFile) ) {
8135
	if ( !pVfs->addMod(sCatFile) ) {
8110
		delete pVfs;
8136
		delete pVfs;
8111
		return NULL;
8137
		return NULL;
8112
	}
8138
	}
8113
 
8139
 
8114
	CXspFile *newShip = new CXspFile;
8140
	CXspFile *newShip = new CXspFile;
8115
	if ( !newShip->extractShip(pVfs, sId, progress) ) {
8141
	if ( !newShip->extractShip(pVfs, sId, progress) ) {
8116
		delete newShip;
8142
		delete newShip;
8117
		newShip = NULL;
8143
		newShip = NULL;
8118
	}
8144
	}
8119
 
8145
 
8120
	delete pVfs;
8146
	delete pVfs;
8121
 
8147
 
8122
	return newShip;
8148
	return newShip;
8123
}
8149
}
8124
 
8150
 
8125
void CPackages::getMergedFiles(Utils::CStringList &list, CCatFile *cat1, CCatFile *cat2)
8151
void CPackages::getMergedFiles(Utils::CStringList &list, CCatFile *cat1, CCatFile *cat2)
8126
{
8152
{
Line 8456... Line 8482...
8456
 
8482
 
8457
	return p;
8483
	return p;
8458
}
8484
}
8459
 
8485
 
8460
Utils::String CPackages::FormatAvailablePackageData(CBaseFile *package)
8486
Utils::String CPackages::FormatAvailablePackageData(CBaseFile *package)
8461
{
8487
{
8462
	SAvailablePackage *p = CPackages::CreateAvailablePackageData(package);
8488
	SAvailablePackage *p = CPackages::CreateAvailablePackageData(package);
8463
	Utils::String ret = CPackages::FormatAvailablePackageData(p);
8489
	Utils::String ret = CPackages::FormatAvailablePackageData(p);
8464
	delete p;
8490
	delete p;
8465
	return ret;
8491
	return ret;
8466
}
8492
}
8467
 
8493
 
8468
Utils::String CPackages::FormatAvailablePackageData(SAvailablePackage *package)
8494
Utils::String CPackages::FormatAvailablePackageData(SAvailablePackage *package)
8469
{
8495
{
8470
	Utils::String ret = (long)package->iType;
8496
	Utils::String ret = (long)package->iType;
8471
 
8497
 
8472
	Utils::String gameCompat;
8498
	Utils::String gameCompat;
8473
	for ( CListNode<SGameCompat> *node = package->lGames.Front(); node; node = node->next() ) {
8499
	for ( CListNode<SGameCompat> *node = package->lGames.Front(); node; node = node->next() ) {
8474
		if ( !gameCompat.empty() )
8500
		if ( !gameCompat.empty() )
8475
			gameCompat += "!";
8501
			gameCompat += "!";
8476
		gameCompat += Utils::String::Number(node->Data()->iGame);
8502
		gameCompat += Utils::String::Number(node->Data()->iGame);
8477
	}
8503
	}
8478
 
8504
 
8479
	if ( gameCompat.empty() )
8505
	if ( gameCompat.empty() )
8480
		gameCompat = "0";
8506
		gameCompat = "0";
8481
 
8507
 
8482
	ret = ret.addToken("::", gameCompat);
8508
	ret = ret.addToken("::", gameCompat);
8483
	ret = ret.addToken("::", package->sName);
8509
	ret = ret.addToken("::", package->sName);
8484
	ret = ret.addToken("::", package->sAuthor);
8510
	ret = ret.addToken("::", package->sAuthor);
8485
	ret = ret.addToken("::", package->sVersion);
8511
	ret = ret.addToken("::", package->sVersion);
8486
	ret = ret.addToken("::", package->sUpdated);
8512
	ret = ret.addToken("::", package->sUpdated);
Line 8518... Line 8544...
8518
			for(int i = 1; i <= sGame.countToken("!"); i++) {
8544
			for(int i = 1; i <= sGame.countToken("!"); i++) {
8519
				SGameCompat *gc = new SGameCompat;
8545
				SGameCompat *gc = new SGameCompat;
8520
				gc->iVersion = 0;
8546
				gc->iVersion = 0;
8521
				gc->iGame = sGame.token("!", i).toLong();
8547
				gc->iGame = sGame.token("!", i).toLong();
8522
				p->lGames.push_back(gc);
8548
				p->lGames.push_back(gc);
8523
			}
8549
			}
8524
		}
8550
		}
8525
		else {
8551
		else {
8526
			SGameCompat *gc = new SGameCompat;
8552
			SGameCompat *gc = new SGameCompat;
8527
			gc->iVersion = 0;
8553
			gc->iVersion = 0;
8528
			gc->iGame = sGame.toLong();
8554
			gc->iGame = sGame.toLong();
Line 8623... Line 8649...
8623
			list->PushBack(CyString(node->Data()->webAddress()), true);
8649
			list->PushBack(CyString(node->Data()->webAddress()), true);
8624
		if ( node->Data()->AnyWebMirrors() )
8650
		if ( node->Data()->AnyWebMirrors() )
8625
		{
8651
		{
8626
			for ( SStringList *str = node->Data()->GetWebMirrors()->Head(); str; str = str->next )
8652
			for ( SStringList *str = node->Data()->GetWebMirrors()->Head(); str; str = str->next )
8627
				list->PushBack(str->str, true);
8653
				list->PushBack(str->str, true);
8628
		}
8654
		}
8629
	}
8655
	}
8630
 
8656
 
8631
	CFileIO File("data\\web");
8657
	CFileIO File("data\\web");
8632
 
8658
 
8633
	if ( File.startRead() ) {
8659
	if ( File.startRead() ) {
8634
		while(!File.atEnd()) {
8660
		while(!File.atEnd()) {
8635
			Utils::String line = File.readEndOfLine();
8661
			Utils::String line = File.readEndOfLine();
8636
			line.removeChar("\n\r\t ");
8662
			line.removeChar("\n\r\t ");
8637
			if ( !line.empty() )
8663
			if ( !line.empty() )
Line 8951... Line 8977...
8951
	}
8977
	}
8952
 
8978
 
8953
	return archive;
8979
	return archive;
8954
}
8980
}
8955
 
8981
 
8956
CyString CPackages::CreateFromPackagerScript(CyString filename)
8982
Utils::String CPackages::CreateFromPackagerScript(CPackages *packages, const Utils::String &filename)
8957
{
8983
{
8958
	CyString curDir = CFileIO(filename).dir();
8984
	Utils::String curDir = CFileIO(filename).dir();
8959
	CyStringList variables;
8985
	Utils::CStringList variables;
8960
	variables.PushBack("$PATH", curDir);
8986
	variables.pushBack("$PATH", curDir);
8961
	CPackages p;
-
 
8962
	CBaseFile *package = p.LoadPackagerScript(filename, NULL, NULL, NULL, &variables);
8987
	CBaseFile *package = packages->LoadPackagerScript(filename, NULL, NULL, NULL, &variables);
8963
 
8988
 
8964
	if ( !package )
8989
	if ( !package )
8965
		return NullString;
8990
		return Utils::String::Null();
8966
 
8991
 
8967
	CyString saveto = package->filename();
8992
	Utils::String saveto = package->filename();
8968
	saveto = saveto.FindReplace("$DEFAULTDIR", curDir + "/");
8993
	saveto = saveto.findReplace("$DEFAULTDIR", curDir + "/");
8969
	saveto = saveto.FindReplace("$PATH", curDir);
8994
	saveto = saveto.findReplace("$PATH", curDir);
8970
	saveto = saveto.FindReplace("\\", "/");
8995
	saveto = saveto.findReplace("\\", "/");
8971
	saveto = saveto.FindReplace("//", "/");
8996
	saveto = saveto.findReplace("//", "/");
8972
	if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
8997
	if ( !saveto.right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
8973
		saveto += ".spk";
8998
		saveto += ".spk";
8974
	else if ( !saveto.Right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
8999
	else if ( !saveto.right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
8975
		saveto += ".xsp";
9000
		saveto += ".xsp";
8976
 
9001
 
8977
	// write script
9002
	// write script
8978
	if ( package->WriteFile(saveto) )
9003
	if ( package->WriteFile(saveto) )
8979
	{
9004
	{
8980
		if ( package->AutoGenerateUpdateFile() )
9005
		if ( package->AutoGenerateUpdateFile() )
8981
			package->CreateUpdateFile(CFileIO(saveto).dir());
9006
			package->CreateUpdateFile(CFileIO(saveto).dir());
8982
		return saveto;
9007
		return saveto;
8983
	}
9008
	}
8984
 
9009
 
8985
	return NullString;
9010
	return Utils::String::Null();
8986
}
9011
}
8987
 
9012
 
8988
int CPackages::GeneratePackageUpdateData(CyString dir, bool includeSingle)
9013
int CPackages::GeneratePackageUpdateData(CyString dir, bool includeSingle)
8989
{
9014
{
8990
	Utils::CStringList filedata;
9015
	Utils::CStringList filedata;