mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 00:29:19 +02:00
backslash/slash fixes, again
This commit is contained in:
@@ -688,7 +688,7 @@ void TAnimModel::AnimationVND(void *pData, double a, double b, double c, double
|
|||||||
if (0) //jeśli włączone sortowanie plików VMD (trochę się przeciąga)
|
if (0) //jeśli włączone sortowanie plików VMD (trochę się przeciąga)
|
||||||
if (pAdvanced->SortByBone()) //próba posortowania
|
if (pAdvanced->SortByBone()) //próba posortowania
|
||||||
{//zapisać posortowany plik, jeśli dokonano zmian
|
{//zapisać posortowany plik, jeśli dokonano zmian
|
||||||
TFileStream *fs=new TFileStream("models\\1.vmd",fmCreate);
|
TFileStream *fs=new TFileStream("models/1.vmd",fmCreate);
|
||||||
fs->Write(pData,2198342); //2948728);
|
fs->Write(pData,2198342); //2948728);
|
||||||
delete fs;
|
delete fs;
|
||||||
}
|
}
|
||||||
|
|||||||
11
DynObj.cpp
11
DynObj.cpp
@@ -1735,7 +1735,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
)
|
)
|
||||||
{ // Ustawienie początkowe pojazdu
|
{ // Ustawienie początkowe pojazdu
|
||||||
iDirection = (Reversed ? 0 : 1); // Ra: 0, jeśli ma być wstawiony jako obrócony tyłem
|
iDirection = (Reversed ? 0 : 1); // Ra: 0, jeśli ma być wstawiony jako obrócony tyłem
|
||||||
asBaseDir = "dynamic\\" + BaseDir + "\\"; // McZapkie-310302
|
asBaseDir = "dynamic/" + BaseDir + "/"; // McZapkie-310302
|
||||||
asName = Name;
|
asName = Name;
|
||||||
std::string asAnimName = ""; // zmienna robocza do wyszukiwania osi i wózków
|
std::string asAnimName = ""; // zmienna robocza do wyszukiwania osi i wózków
|
||||||
// Ra: zmieniamy znaczenie obsady na jednoliterowe, żeby dosadzić kierownika
|
// Ra: zmieniamy znaczenie obsady na jednoliterowe, żeby dosadzić kierownika
|
||||||
@@ -1770,9 +1770,9 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
if (!MoverParameters->LoadFIZ(asBaseDir))
|
if (!MoverParameters->LoadFIZ(asBaseDir))
|
||||||
{ // jak wczytanie CHK się nie uda, to błąd
|
{ // jak wczytanie CHK się nie uda, to błąd
|
||||||
if (ConversionError == 666)
|
if (ConversionError == 666)
|
||||||
ErrorLog( "Bad vehicle: failed do locate definition file \"" + BaseDir + "\\" + Type_Name + ".fiz" + "\"" );
|
ErrorLog( "Bad vehicle: failed do locate definition file \"" + BaseDir + "/" + Type_Name + ".fiz" + "\"" );
|
||||||
else {
|
else {
|
||||||
ErrorLog( "Bad vehicle: failed to load definition from file \"" + BaseDir + "\\" + Type_Name + ".fiz\" (error " + to_string( ConversionError ) + ")" );
|
ErrorLog( "Bad vehicle: failed to load definition from file \"" + BaseDir + "/" + Type_Name + ".fiz\" (error " + to_string( ConversionError ) + ")" );
|
||||||
}
|
}
|
||||||
return 0.0; // zerowa długość to brak pojazdu
|
return 0.0; // zerowa długość to brak pojazdu
|
||||||
}
|
}
|
||||||
@@ -1782,7 +1782,7 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424"
|
|||||||
(fVel > 0 ? 1 : -1) * Cab *
|
(fVel > 0 ? 1 : -1) * Cab *
|
||||||
(iDirection ? 1 : -1))) // jak jedzie lub obsadzony to gotowy do drogi
|
(iDirection ? 1 : -1))) // jak jedzie lub obsadzony to gotowy do drogi
|
||||||
{
|
{
|
||||||
Error("Parameters mismatch: dynamic object " + asName + " from\n" + BaseDir + "\\" +
|
Error("Parameters mismatch: dynamic object " + asName + " from\n" + BaseDir + "/" +
|
||||||
Type_Name);
|
Type_Name);
|
||||||
return 0.0; // zerowa długość to brak pojazdu
|
return 0.0; // zerowa długość to brak pojazdu
|
||||||
}
|
}
|
||||||
@@ -4142,6 +4142,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
m_materialdata.multi_textures = 0; // czy jest wiele tekstur wymiennych?
|
m_materialdata.multi_textures = 0; // czy jest wiele tekstur wymiennych?
|
||||||
parser.getTokens();
|
parser.getTokens();
|
||||||
parser >> asModel;
|
parser >> asModel;
|
||||||
|
std::replace(asModel.begin(), asModel.end(), '\\', '/');
|
||||||
if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
|
if( asModel[asModel.size() - 1] == '#' ) // Ra 2015-01: nie podoba mi siê to
|
||||||
{ // model wymaga wielu tekstur wymiennych
|
{ // model wymaga wielu tekstur wymiennych
|
||||||
m_materialdata.multi_textures = 1;
|
m_materialdata.multi_textures = 1;
|
||||||
@@ -4176,6 +4177,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
std::string texturename; nameparser >> texturename;
|
std::string texturename; nameparser >> texturename;
|
||||||
while( ( texturename != "" ) && ( skinindex < 4 ) ) {
|
while( ( texturename != "" ) && ( skinindex < 4 ) ) {
|
||||||
erase_extension( texturename );
|
erase_extension( texturename );
|
||||||
|
std::replace(texturename.begin(), texturename.end(), '\\', '/');
|
||||||
m_materialdata.replacable_skins[ skinindex + 1 ] = GfxRenderer.Fetch_Material( Global.asCurrentTexturePath + texturename );
|
m_materialdata.replacable_skins[ skinindex + 1 ] = GfxRenderer.Fetch_Material( Global.asCurrentTexturePath + texturename );
|
||||||
++skinindex;
|
++skinindex;
|
||||||
texturename = ""; nameparser >> texturename;
|
texturename = ""; nameparser >> texturename;
|
||||||
@@ -4355,6 +4357,7 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
// ABu: wnetrze lowpoly
|
// ABu: wnetrze lowpoly
|
||||||
parser.getTokens();
|
parser.getTokens();
|
||||||
parser >> asModel;
|
parser >> asModel;
|
||||||
|
std::replace(asModel.begin(), asModel.end(), '\\', '/');
|
||||||
asModel = BaseDir + asModel; // McZapkie-200702 - dynamics maja swoje modele w dynamic/basedir
|
asModel = BaseDir + asModel; // McZapkie-200702 - dynamics maja swoje modele w dynamic/basedir
|
||||||
Global.asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/...
|
Global.asCurrentTexturePath = BaseDir; // biezaca sciezka do tekstur to dynamic/...
|
||||||
mdLowPolyInt = TModelsManager::GetModel(asModel, true);
|
mdLowPolyInt = TModelsManager::GetModel(asModel, true);
|
||||||
|
|||||||
3
EU07.cpp
3
EU07.cpp
@@ -270,7 +270,10 @@ int main(int argc, char *argv[])
|
|||||||
Global.iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
Global.iConvertModels = -7; // z optymalizacją, bananami i prawidłowym Opacity
|
||||||
}
|
}
|
||||||
else if (i + 1 < argc && token == "-s")
|
else if (i + 1 < argc && token == "-s")
|
||||||
|
{
|
||||||
Global.SceneryFile = std::string(argv[++i]);
|
Global.SceneryFile = std::string(argv[++i]);
|
||||||
|
std::replace(Global.SceneryFile.begin(), Global.SceneryFile.end(), '\\', '/');
|
||||||
|
}
|
||||||
else if (i + 1 < argc && token == "-v")
|
else if (i + 1 < argc && token == "-v")
|
||||||
{
|
{
|
||||||
std::string v(argv[++i]);
|
std::string v(argv[++i]);
|
||||||
|
|||||||
@@ -6707,7 +6707,6 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
|
|||||||
|
|
||||||
WriteLog("LOAD FIZ FROM " + file);
|
WriteLog("LOAD FIZ FROM " + file);
|
||||||
|
|
||||||
std::replace(file.begin(), file.end(), '\\', '/');
|
|
||||||
std::ifstream in(file);
|
std::ifstream in(file);
|
||||||
if (!in.is_open())
|
if (!in.is_open())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,6 +81,10 @@ TModelsManager::GetModel(std::string const &Name, bool const Dynamic)
|
|||||||
// - wczytanie modelu animowanego - Init() - sprawdzić
|
// - wczytanie modelu animowanego - Init() - sprawdzić
|
||||||
std::string const buftp { Global.asCurrentTexturePath }; // zapamiętanie aktualnej ścieżki do tekstur,
|
std::string const buftp { Global.asCurrentTexturePath }; // zapamiętanie aktualnej ścieżki do tekstur,
|
||||||
std::string filename { Name };
|
std::string filename { Name };
|
||||||
|
if (Name.find('\\') != std::string::npos)
|
||||||
|
{
|
||||||
|
ErrorLog("internal error: backslash in GetModel: " + Name);
|
||||||
|
}
|
||||||
if( Name.find( '/' ) != std::string::npos ) {
|
if( Name.find( '/' ) != std::string::npos ) {
|
||||||
// pobieranie tekstur z katalogu, w którym jest model
|
// pobieranie tekstur z katalogu, w którym jest model
|
||||||
Global.asCurrentTexturePath += Name;
|
Global.asCurrentTexturePath += Name;
|
||||||
|
|||||||
14
Model3d.cpp
14
Model3d.cpp
@@ -300,6 +300,7 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
|
|||||||
if (!parser.expectToken("map:"))
|
if (!parser.expectToken("map:"))
|
||||||
Error("Model map parse failure!");
|
Error("Model map parse failure!");
|
||||||
std::string material = parser.getToken<std::string>();
|
std::string material = parser.getToken<std::string>();
|
||||||
|
std::replace(material.begin(), material.end(), '\\', '/');
|
||||||
if (material == "none")
|
if (material == "none")
|
||||||
{ // rysowanie podanym kolorem
|
{ // rysowanie podanym kolorem
|
||||||
m_material = null_handle;
|
m_material = null_handle;
|
||||||
@@ -333,7 +334,7 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
|
|||||||
else
|
else
|
||||||
{ // jeśli tylko nazwa pliku, to dawać bieżącą ścieżkę do tekstur
|
{ // jeśli tylko nazwa pliku, to dawać bieżącą ścieżkę do tekstur
|
||||||
Name_Material(material);
|
Name_Material(material);
|
||||||
if( material.find_first_of( "/\\" ) == material.npos ) {
|
if( material.find_first_of( "/" ) == material.npos ) {
|
||||||
material.insert( 0, Global.asCurrentTexturePath );
|
material.insert( 0, Global.asCurrentTexturePath );
|
||||||
}
|
}
|
||||||
m_material = GfxRenderer.Fetch_Material( material );
|
m_material = GfxRenderer.Fetch_Material( material );
|
||||||
@@ -1233,7 +1234,6 @@ bool TModel3d::LoadFromFile(std::string const &FileName, bool dynamic)
|
|||||||
{
|
{
|
||||||
// wczytanie modelu z pliku
|
// wczytanie modelu z pliku
|
||||||
std::string name = ToLower(FileName);
|
std::string name = ToLower(FileName);
|
||||||
std::replace(name.begin(), name.end(), '\\', '/');
|
|
||||||
// trim extension if needed
|
// trim extension if needed
|
||||||
if( name.rfind( '.' ) != std::string::npos )
|
if( name.rfind( '.' ) != std::string::npos )
|
||||||
{
|
{
|
||||||
@@ -1597,7 +1597,11 @@ void TModel3d::deserialize(std::istream &s, size_t size, bool dynamic)
|
|||||||
if (Textures.size())
|
if (Textures.size())
|
||||||
throw std::runtime_error("e3d: duplicated TEX chunk");
|
throw std::runtime_error("e3d: duplicated TEX chunk");
|
||||||
while (s.tellg() < end)
|
while (s.tellg() < end)
|
||||||
Textures.push_back(sn_utils::d_str(s));
|
{
|
||||||
|
std::string str = sn_utils::d_str(s);
|
||||||
|
std::replace(str.begin(), str.end(), '\\', '/');
|
||||||
|
Textures.push_back(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (type == MAKE_ID4('N', 'A', 'M', '0'))
|
else if (type == MAKE_ID4('N', 'A', 'M', '0'))
|
||||||
{
|
{
|
||||||
@@ -1664,7 +1668,7 @@ void TSubModel::BinInit(TSubModel *s, float4x4 *m, std::vector<std::string> *t,
|
|||||||
auto const materialindex = static_cast<std::size_t>( iTexture );
|
auto const materialindex = static_cast<std::size_t>( iTexture );
|
||||||
if( materialindex < t->size() ) {
|
if( materialindex < t->size() ) {
|
||||||
m_materialname = t->at( materialindex );
|
m_materialname = t->at( materialindex );
|
||||||
if( m_materialname.find_last_of( "/\\" ) == std::string::npos ) {
|
if( m_materialname.find_last_of( "/" ) == std::string::npos ) {
|
||||||
m_materialname = Global.asCurrentTexturePath + m_materialname;
|
m_materialname = Global.asCurrentTexturePath + m_materialname;
|
||||||
}
|
}
|
||||||
m_material = GfxRenderer.Fetch_Material( m_materialname );
|
m_material = GfxRenderer.Fetch_Material( m_materialname );
|
||||||
@@ -1749,7 +1753,7 @@ void TModel3d::LoadFromTextFile(std::string const &FileName, bool dynamic)
|
|||||||
{ // wczytanie submodelu z pliku tekstowego
|
{ // wczytanie submodelu z pliku tekstowego
|
||||||
WriteLog( "Loading text format 3d model data from \"" + FileName + "\"...", logtype::model );
|
WriteLog( "Loading text format 3d model data from \"" + FileName + "\"...", logtype::model );
|
||||||
iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle)
|
iFlags |= 0x0200; // wczytano z pliku tekstowego (właścicielami tablic są submodle)
|
||||||
cParser parser(FileName, cParser::buffer_FILE); // Ra: tu powinno być "models\\"...
|
cParser parser(FileName, cParser::buffer_FILE); // Ra: tu powinno być "models/"...
|
||||||
TSubModel *SubModel;
|
TSubModel *SubModel;
|
||||||
std::string token = parser.getToken<std::string>();
|
std::string token = parser.getToken<std::string>();
|
||||||
iNumVerts = 0; // w konstruktorze to jest
|
iNumVerts = 0; // w konstruktorze to jest
|
||||||
|
|||||||
@@ -479,7 +479,6 @@ void TPythonScreens::update()
|
|||||||
void TPythonScreens::setLookupPath(std::string const &path)
|
void TPythonScreens::setLookupPath(std::string const &path)
|
||||||
{
|
{
|
||||||
_lookupPath = path;
|
_lookupPath = path;
|
||||||
std::replace(_lookupPath.begin(), _lookupPath.end(), '\\', '/');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TPythonScreens::TPythonScreens()
|
TPythonScreens::TPythonScreens()
|
||||||
|
|||||||
@@ -817,10 +817,6 @@ texture_manager::create( std::string Filename, bool const Loadnow ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
erase_extension( Filename );
|
erase_extension( Filename );
|
||||||
// change slashes to cross-platform
|
|
||||||
std::replace(
|
|
||||||
std::begin( Filename ), std::end( Filename ),
|
|
||||||
'\\', '/' );
|
|
||||||
|
|
||||||
std::vector<std::string> extensions{ { ".dds" }, { ".tga" }, { ".png" }, { ".bmp" }, { ".ext" } };
|
std::vector<std::string> extensions{ { ".dds" }, { ".tga" }, { ".png" }, { ".bmp" }, { ".ext" } };
|
||||||
|
|
||||||
|
|||||||
@@ -5586,6 +5586,7 @@ bool TTrain::InitializeCab(int NewCabNo, std::string const &asFileName)
|
|||||||
// model kabiny
|
// model kabiny
|
||||||
parser->getTokens();
|
parser->getTokens();
|
||||||
*parser >> token;
|
*parser >> token;
|
||||||
|
std::replace(token.begin(), token.end(), '\\', '/');
|
||||||
if (token != "none")
|
if (token != "none")
|
||||||
{
|
{
|
||||||
// bieżąca sciezka do tekstur to dynamic/...
|
// bieżąca sciezka do tekstur to dynamic/...
|
||||||
|
|||||||
@@ -1982,7 +1982,7 @@ void TWorld::CreateE3D(std::string const &Path, bool Dynamic)
|
|||||||
// launch recursive search for sub-directories...
|
// launch recursive search for sub-directories...
|
||||||
if( filename == "." ) { continue; }
|
if( filename == "." ) { continue; }
|
||||||
if( filename == ".." ) { continue; }
|
if( filename == ".." ) { continue; }
|
||||||
CreateE3D( Path + filename + "\\", Dynamic );
|
CreateE3D( Path + filename + "/", Dynamic );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// process the file
|
// process the file
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
|||||||
si.format = 0;
|
si.format = 0;
|
||||||
|
|
||||||
std::string file = Filename;
|
std::string file = Filename;
|
||||||
std::replace(file.begin(), file.end(), '\\', '/');
|
|
||||||
|
|
||||||
WriteLog("sound: loading file: " + file);
|
WriteLog("sound: loading file: " + file);
|
||||||
|
|
||||||
@@ -105,10 +104,6 @@ buffer_manager::create( std::string const &Filename ) {
|
|||||||
auto filename { ToLower( Filename ) };
|
auto filename { ToLower( Filename ) };
|
||||||
|
|
||||||
erase_extension( filename );
|
erase_extension( filename );
|
||||||
// convert slashes
|
|
||||||
std::replace(
|
|
||||||
std::begin( filename ), std::end( filename ),
|
|
||||||
'\\', '/' );
|
|
||||||
|
|
||||||
audio::buffer_handle lookup { null_handle };
|
audio::buffer_handle lookup { null_handle };
|
||||||
std::string filelookup;
|
std::string filelookup;
|
||||||
|
|||||||
10
material.cpp
10
material.cpp
@@ -18,7 +18,6 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
std::string path( std::string const &Filename )
|
std::string path( std::string const &Filename )
|
||||||
{
|
{
|
||||||
std::string fn = Filename;
|
std::string fn = Filename;
|
||||||
std::replace(fn.begin(), fn.end(), '\\', '/');
|
|
||||||
return (
|
return (
|
||||||
fn.rfind( '/' ) != std::string::npos ?
|
fn.rfind( '/' ) != std::string::npos ?
|
||||||
fn.substr( 0, fn.rfind( '/' ) + 1 ) :
|
fn.substr( 0, fn.rfind( '/' ) + 1 ) :
|
||||||
@@ -49,7 +48,7 @@ opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool c
|
|||||||
|
|
||||||
if( ( true == key.empty() ) || ( key == "}" ) ) { return false; }
|
if( ( true == key.empty() ) || ( key == "}" ) ) { return false; }
|
||||||
|
|
||||||
auto const value { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
auto value { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
||||||
|
|
||||||
if( Priority != -1 ) {
|
if( Priority != -1 ) {
|
||||||
// regular attribute processing mode
|
// regular attribute processing mode
|
||||||
@@ -69,6 +68,7 @@ opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool c
|
|||||||
else if( key == "texture1:" ) {
|
else if( key == "texture1:" ) {
|
||||||
if( ( texture1 == null_handle )
|
if( ( texture1 == null_handle )
|
||||||
|| ( Priority > priority1 ) ) {
|
|| ( Priority > priority1 ) ) {
|
||||||
|
std::replace(value.begin(), value.end(), '\\', '/');
|
||||||
texture1 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
texture1 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
||||||
priority1 = Priority;
|
priority1 = Priority;
|
||||||
}
|
}
|
||||||
@@ -76,6 +76,7 @@ opengl_material::deserialize_mapping( cParser &Input, int const Priority, bool c
|
|||||||
else if( key == "texture2:" ) {
|
else if( key == "texture2:" ) {
|
||||||
if( ( texture2 == null_handle )
|
if( ( texture2 == null_handle )
|
||||||
|| ( Priority > priority2 ) ) {
|
|| ( Priority > priority2 ) ) {
|
||||||
|
std::replace(value.begin(), value.end(), '\\', '/');
|
||||||
texture2 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
texture2 = GfxRenderer.Fetch_Texture( value, Loadnow );
|
||||||
priority2 = Priority;
|
priority2 = Priority;
|
||||||
}
|
}
|
||||||
@@ -116,11 +117,6 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
|
|||||||
erase_extension( filename );
|
erase_extension( filename );
|
||||||
filename += ".mat";
|
filename += ".mat";
|
||||||
|
|
||||||
// change slashes to llinux-compatible
|
|
||||||
std::replace(
|
|
||||||
std::begin( filename ), std::end( filename ),
|
|
||||||
'\\', '/' );
|
|
||||||
|
|
||||||
// try to locate requested material in the databank
|
// try to locate requested material in the databank
|
||||||
auto const databanklookup = find_in_databank( filename );
|
auto const databanklookup = find_in_databank( filename );
|
||||||
if( databanklookup != null_handle ) {
|
if( databanklookup != null_handle ) {
|
||||||
|
|||||||
@@ -242,7 +242,6 @@ bool TTrainParameters::LoadTTfile(std::string scnpath, int iPlus, double vmax)
|
|||||||
ConversionError = 666;
|
ConversionError = 666;
|
||||||
vActual = -1;
|
vActual = -1;
|
||||||
s = scnpath + TrainName + ".txt";
|
s = scnpath + TrainName + ".txt";
|
||||||
std::replace(s.begin(), s.end(), '\\', '/');
|
|
||||||
// Ra 2014-09: ustalić zasady wyznaczenia pierwotnego pliku przy przesuniętych rozkładach
|
// Ra 2014-09: ustalić zasady wyznaczenia pierwotnego pliku przy przesuniętych rozkładach
|
||||||
// (kolejny pociąg dostaje numer +2)
|
// (kolejny pociąg dostaje numer +2)
|
||||||
fin.open(s.c_str()); // otwieranie pliku
|
fin.open(s.c_str()); // otwieranie pliku
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ cParser::cParser( std::string const &Stream, buffertype const Type, std::string
|
|||||||
switch (Type) {
|
switch (Type) {
|
||||||
case buffer_FILE: {
|
case buffer_FILE: {
|
||||||
Path.append( Stream );
|
Path.append( Stream );
|
||||||
std::replace(Path.begin(), Path.end(), '\\', '/');
|
|
||||||
mStream = std::make_shared<std::ifstream>( Path );
|
mStream = std::make_shared<std::ifstream>( Path );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -216,6 +215,7 @@ std::string cParser::readToken( bool ToLower, const char *Break ) {
|
|||||||
// launch child parser if include directive found.
|
// launch child parser if include directive found.
|
||||||
// NOTE: parameter collecting uses default set of token separators.
|
// NOTE: parameter collecting uses default set of token separators.
|
||||||
std::string includefile = readToken(ToLower); // nazwa pliku
|
std::string includefile = readToken(ToLower); // nazwa pliku
|
||||||
|
std::replace(includefile.begin(), includefile.end(), '\\', '/');
|
||||||
if( ( true == LoadTraction )
|
if( ( true == LoadTraction )
|
||||||
|| ( ( includefile.find( "tr/" ) == std::string::npos )
|
|| ( ( includefile.find( "tr/" ) == std::string::npos )
|
||||||
&& ( includefile.find( "tra/" ) == std::string::npos ) ) ) {
|
&& ( includefile.find( "tra/" ) == std::string::npos ) ) ) {
|
||||||
|
|||||||
@@ -734,9 +734,14 @@ state_manager::deserialize_dynamic( cParser &Input, scene::scratch_data &Scratch
|
|||||||
}
|
}
|
||||||
auto const inputline { Input.Line() }; // cache in case of errors
|
auto const inputline { Input.Line() }; // cache in case of errors
|
||||||
// basic attributes
|
// basic attributes
|
||||||
auto const datafolder { Input.getToken<std::string>() };
|
auto datafolder { Input.getToken<std::string>() };
|
||||||
auto const skinfile { Input.getToken<std::string>() };
|
auto skinfile { Input.getToken<std::string>() };
|
||||||
auto const mmdfile { Input.getToken<std::string>() };
|
auto mmdfile { Input.getToken<std::string>() };
|
||||||
|
|
||||||
|
std::replace(datafolder.begin(), datafolder.end(), '\\', '/');
|
||||||
|
std::replace(skinfile.begin(), skinfile.end(), '\\', '/');
|
||||||
|
std::replace(mmdfile.begin(), mmdfile.end(), '\\', '/');
|
||||||
|
|
||||||
auto const pathname = (
|
auto const pathname = (
|
||||||
Scratchpad.trainset.is_open ?
|
Scratchpad.trainset.is_open ?
|
||||||
Scratchpad.trainset.track :
|
Scratchpad.trainset.track :
|
||||||
|
|||||||
@@ -143,6 +143,7 @@ std::string
|
|||||||
sound_source::deserialize_filename( cParser &Input ) {
|
sound_source::deserialize_filename( cParser &Input ) {
|
||||||
|
|
||||||
auto token { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
auto token { Input.getToken<std::string>( true, "\n\r\t ,;" ) };
|
||||||
|
std::replace(token.begin(), token.end(), '\\', '/');
|
||||||
if( token != "[" ) {
|
if( token != "[" ) {
|
||||||
// simple case, single file
|
// simple case, single file
|
||||||
return token;
|
return token;
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
void
|
void
|
||||||
cStars::init() {
|
cStars::init() {
|
||||||
|
|
||||||
m_stars = TModelsManager::GetModel( "models\\skydome_stars.t3d", false );
|
m_stars = TModelsManager::GetModel( "models/skydome_stars.t3d", false );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,9 +304,7 @@ extract_value( bool &Variable, std::string const &Key, std::string const &Input,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FileExists( std::string const &Filename ) {
|
bool FileExists( std::string const &Filename ) {
|
||||||
std::string fn = Filename;
|
std::ifstream file( Filename );
|
||||||
std::replace(fn.begin(), fn.end(), '\\', '/');
|
|
||||||
std::ifstream file( fn );
|
|
||||||
return( true == file.is_open() );
|
return( true == file.is_open() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,7 +312,6 @@ bool FileExists( std::string const &Filename ) {
|
|||||||
std::time_t
|
std::time_t
|
||||||
last_modified( std::string const &Filename ) {
|
last_modified( std::string const &Filename ) {
|
||||||
std::string fn = Filename;
|
std::string fn = Filename;
|
||||||
std::replace(fn.begin(), fn.end(), '\\', '/');
|
|
||||||
struct stat filestat;
|
struct stat filestat;
|
||||||
if( ::stat( fn.c_str(), &filestat ) == 0 )
|
if( ::stat( fn.c_str(), &filestat ) == 0 )
|
||||||
return filestat.st_mtime;
|
return filestat.st_mtime;
|
||||||
|
|||||||
Reference in New Issue
Block a user