Changed: Expand environment variables in paths read from cfg files

This commit is contained in:
kervala 2016-01-13 19:59:09 +01:00
parent 854d4dd624
commit b82f133585
9 changed files with 17 additions and 17 deletions

View file

@ -1169,7 +1169,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
{ {
for (uint i = 0; i < var->size(); i++) for (uint i = 0; i < var->size(); i++)
{ {
CPath::addSearchPath (var->asString(i), true, false); CPath::addSearchPath (NLMISC::expandEnvironmentVariables(var->asString(i)), true, false);
} }
} }
@ -1177,7 +1177,7 @@ sint IService::main (const char *serviceShortName, const char *serviceLongName,
{ {
for (uint i = 0; i < var->size(); i++) for (uint i = 0; i < var->size(); i++)
{ {
CPath::addSearchPath (var->asString(i), false, false); CPath::addSearchPath (NLMISC::expandEnvironmentVariables(var->asString(i)), false, false);
} }
} }

View file

@ -906,7 +906,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
{ {
addSearchPath=true; addSearchPath=true;
for (uint32 i=0;i<varPtr->size();++i) for (uint32 i=0;i<varPtr->size();++i)
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
} }
loadForm2("aiaction", writeFilesDirectoryName+AISPackedActionSheetsFilename, _ActionSheets, true); loadForm2("aiaction", writeFilesDirectoryName+AISPackedActionSheetsFilename, _ActionSheets, true);
} }
@ -918,7 +918,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
{ {
addSearchPath=true; addSearchPath=true;
for (uint32 i=0;i<varPtr->size();++i) for (uint32 i=0;i<varPtr->size();++i)
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
} }
loadForm("actionlist", writeFilesDirectoryName+AISPackedFightConfigSheetsFilename, _ActionListSheets, true); loadForm("actionlist", writeFilesDirectoryName+AISPackedFightConfigSheetsFilename, _ActionListSheets, true);
} }
@ -931,7 +931,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
{ {
addSearchPath=true; addSearchPath=true;
for (uint32 i=0;i<varPtr->size();++i) for (uint32 i=0;i<varPtr->size();++i)
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
} }
loadForm2("creature", writeFilesDirectoryName+AISPackedSheetsFilename, _Sheets, true); loadForm2("creature", writeFilesDirectoryName+AISPackedSheetsFilename, _Sheets, true);
} }
@ -943,7 +943,7 @@ void AISHEETS::CSheets::packSheets(const std::string &writeFilesDirectoryName)
{ {
addSearchPath=true; addSearchPath=true;
for (uint32 i=0;i<varPtr->size();++i) for (uint32 i=0;i<varPtr->size();++i)
CPath::addSearchPath(varPtr->asString(i).c_str(), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(varPtr->asString(i)), true, false);
} }
loadForm2("race_stats", writeFilesDirectoryName+AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true); loadForm2("race_stats", writeFilesDirectoryName+AISPackedRaceStatsSheetsFilename, _RaceStatsSheets, true);
} }

View file

@ -249,7 +249,7 @@ int main(int argc, char *argv[])
{ {
for(uint i = 0; i < ClientCfg.PreDataPath.size(); ++i) for(uint i = 0; i < ClientCfg.PreDataPath.size(); ++i)
{ {
CPath::addSearchPath(ClientCfg.PreDataPath[i], true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(ClientCfg.PreDataPath[i]), true, false);
} }
} }

View file

@ -390,7 +390,7 @@ int main()
// add the search paths // add the search paths
for (uint i=0; i<paths.size(); ++i) for (uint i=0; i<paths.size(); ++i)
{ {
CPath::addSearchPath(paths.asString(i), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
} }
// init ligo // init ligo

View file

@ -179,7 +179,7 @@ int main( int argc, char ** argv )
sint i; sint i;
for( i = 0; i< (sint)cvSheetPaths.size(); ++i) for( i = 0; i< (sint)cvSheetPaths.size(); ++i)
{ {
sheetPaths.push_back( cvSheetPaths.asString(i) ); sheetPaths.push_back(NLMISC::expandEnvironmentVariables(cvSheetPaths.asString(i)));
} }
} }
catch(const EUnknownVar &) catch(const EUnknownVar &)

View file

@ -108,7 +108,7 @@ int main(int argc, char* argv[])
// //
for(uint k = 0; k < builderConfig.SearchPaths.size(); ++k) for(uint k = 0; k < builderConfig.SearchPaths.size(); ++k)
{ {
CPath::addSearchPath(builderConfig.SearchPaths[k], true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(builderConfig.SearchPaths[k]), true, false);
} }
CPath::remapExtension("dds", "tga", true); CPath::remapExtension("dds", "tga", true);
CPath::remapExtension("dds", "png", true); CPath::remapExtension("dds", "png", true);

View file

@ -83,7 +83,7 @@ bool init()
// Define the root path that contains all data needed for the application. // Define the root path that contains all data needed for the application.
nlinfo("Adding search paths..."); nlinfo("Adding search paths...");
for(uint i = 0; i < AppCfg.DataPath.size(); i++) for(uint i = 0; i < AppCfg.DataPath.size(); i++)
CPath::addSearchPath(AppCfg.DataPath[i], true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(AppCfg.DataPath[i]), true, false);
// Initialize Sheet IDs. // Initialize Sheet IDs.
nlinfo("Init SheetId..."); nlinfo("Init SheetId...");

View file

@ -256,11 +256,11 @@ int extractBotNames(int argc, char *argv[])
for (uint i=0; i<paths.size(); ++i) for (uint i=0; i<paths.size(); ++i)
{ {
CPath::addSearchPath(paths.asString(i), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
} }
for (uint i=0; i<pathNoRecurse.size(); ++i) for (uint i=0; i<pathNoRecurse.size(); ++i)
{ {
CPath::addSearchPath(pathNoRecurse.asString(i), false, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false);
} }
for (uint i=0; i<filtersVar.size(); ++i) for (uint i=0; i<filtersVar.size(); ++i)
@ -278,7 +278,7 @@ int extractBotNames(int argc, char *argv[])
if (Creatures.empty()) if (Creatures.empty())
{ {
for (uint i=0;i<georgesPaths.size();++i) for (uint i=0;i<georgesPaths.size();++i)
CPath::addSearchPath(georgesPaths.asString(i).c_str(), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(georgesPaths.asString(i)), true, false);
loadForm("creature", PACKED_SHEETS_NAME, Creatures, true); loadForm("creature", PACKED_SHEETS_NAME, Creatures, true);
} }

View file

@ -360,15 +360,15 @@ int extractNewSheetNames(int argc, char *argv[])
// parse path // parse path
for (uint i=0; i<paths.size(); ++i) for (uint i=0; i<paths.size(); ++i)
{ {
CPath::addSearchPath(paths.asString(i), true, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(paths.asString(i)), true, false);
} }
for (uint i=0; i<pathNoRecurse.size(); ++i) for (uint i=0; i<pathNoRecurse.size(); ++i)
{ {
CPath::addSearchPath(pathNoRecurse.asString(i), false, false); CPath::addSearchPath(NLMISC::expandEnvironmentVariables(pathNoRecurse.asString(i)), false, false);
} }
// init ligo config once // init ligo config once
string ligoPath = CPath::lookup(ligoClassFile.asString(), true, true); string ligoPath = CPath::lookup(NLMISC::expandEnvironmentVariables(ligoClassFile.asString()), true, true);
LigoConfig.readPrimitiveClass(ligoPath.c_str(), false); LigoConfig.readPrimitiveClass(ligoPath.c_str(), false);
NLLIGO::Register(); NLLIGO::Register();
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;