16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 23:49:19 +02:00

file access cross-platform compatibility fixes

This commit is contained in:
tmj-fstate
2018-03-29 03:48:21 +02:00
parent 64dea17e6f
commit 6ffced1d90
12 changed files with 40 additions and 30 deletions

View File

@@ -17,8 +17,8 @@ http://mozilla.org/MPL/2.0/.
// helper, returns potential path part from provided file name
std::string path( std::string const &Filename ) {
return (
Filename.rfind( '\\' ) != std::string::npos ?
Filename.substr( 0, Filename.rfind( '\\' ) + 1 ) :
Filename.rfind( '/' ) != std::string::npos ?
Filename.substr( 0, Filename.rfind( '/' ) + 1 ) :
"" );
}
@@ -111,12 +111,9 @@ material_manager::create( std::string const &Filename, bool const Loadnow ) {
filename.erase( filename.find( '|' ) ); // po | może być nazwa kolejnej tekstury
erase_extension( filename );
filename += ".mat";
replace_slashes( filename );
// change slashes to llinux-compatible
std::replace(
std::begin( filename ), std::end( filename ),
'\\', '/' );
filename += ".mat";
// try to locate requested material in the databank
auto const databanklookup = find_in_databank( filename );