use ostream_write( CopiedString )

This commit is contained in:
Garux 2021-09-18 15:30:11 +03:00
parent b78513f9f8
commit 02a3b9c026
39 changed files with 104 additions and 105 deletions

View File

@ -87,14 +87,14 @@ typedef std::list<EntityClassAttributePair> EntityClassAttributes;
typedef std::list<CopiedString> StringList; typedef std::list<CopiedString> StringList;
inline const char* EntityClassAttributePair_getName( const EntityClassAttributePair& attributePair ){ inline const char* EntityClassAttributePair_getName( const EntityClassAttributePair& attributePair ){
if ( !string_empty( attributePair.second.m_name.c_str() ) ) { if ( !attributePair.second.m_name.empty() ) {
return attributePair.second.m_name.c_str(); return attributePair.second.m_name.c_str();
} }
return attributePair.first.c_str(); return attributePair.first.c_str();
} }
inline const char* EntityClassAttributePair_getDescription( const EntityClassAttributePair& attributePair ){ inline const char* EntityClassAttributePair_getDescription( const EntityClassAttributePair& attributePair ){
if ( !string_empty( attributePair.second.m_description.c_str() ) ) { if ( !attributePair.second.m_description.empty() ) {
return attributePair.second.m_description.c_str(); return attributePair.second.m_description.c_str();
} }
return EntityClassAttributePair_getName( attributePair ); return EntityClassAttributePair_getName( attributePair );

View File

@ -356,7 +356,7 @@ public:
m_observers.erase( observer ); m_observers.erase( observer );
} }
const char* c_str() const { const char* c_str() const {
if ( string_empty( m_string.c_str() ) ) { if ( m_string.empty() ) {
return m_empty; return m_empty;
} }
return m_string.c_str(); return m_string.c_str();

View File

@ -96,7 +96,7 @@ public:
std::size_t len = strlen( ( *i ).m_name.c_str() ) + strlen( ( *i ).m_pattern.c_str() ) + 3; std::size_t len = strlen( ( *i ).m_name.c_str() ) + strlen( ( *i ).m_pattern.c_str() ) + 3;
StringOutputStream buffer( len + 1 ); // length + null char StringOutputStream buffer( len + 1 ); // length + null char
buffer << ( *i ).m_name.c_str() << " <" << ( *i ).m_pattern.c_str() << ">"; buffer << ( *i ).m_name << " <" << ( *i ).m_pattern << ">";
m_masks.push_back( buffer.c_str() ); m_masks.push_back( buffer.c_str() );
} }

View File

@ -77,6 +77,6 @@ GtkImage* new_image( const char* filename ){
GtkImage* new_local_image( const char* filename ){ GtkImage* new_local_image( const char* filename ){
StringOutputStream fullPath( 256 ); StringOutputStream fullPath( 256 );
fullPath << g_bitmapsPath.c_str() << filename; fullPath << g_bitmapsPath << filename;
return new_image( fullPath.c_str() ); return new_image( fullPath );
} }

View File

@ -92,7 +92,7 @@ public:
PakFileSystem::entry_type& file = m_filesystem[entry.filename]; PakFileSystem::entry_type& file = m_filesystem[entry.filename];
if ( !file.is_directory() ) { if ( !file.is_directory() ) {
globalWarningStream() << "Warning: pak archive " << makeQuoted( m_name.c_str() ) << " contains duplicated file: " << makeQuoted( entry.filename ) << "\n"; globalWarningStream() << "Warning: pak archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( entry.filename ) << "\n";
} }
else else
{ {

View File

@ -161,7 +161,7 @@ class ZipArchive final : public Archive
{ {
ZipFileSystem::entry_type& file = m_filesystem[filename.data()]; ZipFileSystem::entry_type& file = m_filesystem[filename.data()];
if ( !file.is_directory() ) { if ( !file.is_directory() ) {
globalWarningStream() << "Warning: zip archive " << makeQuoted( m_name.c_str() ) << " contains duplicated file: " << makeQuoted( filename.data() ) << "\n"; globalWarningStream() << "Warning: zip archive " << makeQuoted( m_name ) << " contains duplicated file: " << makeQuoted( filename.data() ) << "\n";
} }
else else
{ {
@ -225,7 +225,7 @@ public:
zip_file_header file_header; zip_file_header file_header;
istream_read_zip_file_header( m_istream, file_header ); istream_read_zip_file_header( m_istream, file_header );
if ( file_header.z_magic != zip_file_header_magic ) { if ( file_header.z_magic != zip_file_header_magic ) {
globalErrorStream() << "error reading zip file " << makeQuoted( m_name.c_str() ); globalErrorStream() << "error reading zip file " << makeQuoted( m_name );
return 0; return 0;
} }
@ -248,7 +248,7 @@ public:
zip_file_header file_header; zip_file_header file_header;
istream_read_zip_file_header( m_istream, file_header ); istream_read_zip_file_header( m_istream, file_header );
if ( file_header.z_magic != zip_file_header_magic ) { if ( file_header.z_magic != zip_file_header_magic ) {
globalErrorStream() << "error reading zip file " << makeQuoted( m_name.c_str() ); globalErrorStream() << "error reading zip file " << makeQuoted( m_name );
return 0; return 0;
} }

View File

@ -249,7 +249,7 @@ private:
const CopiedString oldShader( m_shader ); const CopiedString oldShader( m_shader );
if( strchr( m_shader.c_str(), '/' ) == nullptr ){ /* texture is likely in the folder, where model is */ if( strchr( m_shader.c_str(), '/' ) == nullptr ){ /* texture is likely in the folder, where model is */
m_shader = StringOutputStream()( scene.m_rootPath, m_shader.c_str() ); m_shader = StringOutputStream()( scene.m_rootPath, m_shader );
} }
else{ else{
const char *name = m_shader.c_str(); const char *name = m_shader.c_str();
@ -266,7 +266,7 @@ private:
} }
if( oldShader != m_shader ) if( oldShader != m_shader )
globalOutputStream() << "substituting: " << oldShader.c_str() << " -> " << m_shader.c_str() << "\n"; globalOutputStream() << "substituting: " << oldShader << " -> " << m_shader << "\n";
} }
m_vertices.resize( mesh->mNumVertices ); m_vertices.resize( mesh->mNumVertices );

View File

@ -58,7 +58,7 @@ public:
NamedEntity( EntityKeyValues& entity ) : m_entity( entity ){ NamedEntity( EntityKeyValues& entity ) : m_entity( entity ){
} }
const char* name() const { const char* name() const {
if ( string_empty( m_name.c_str() ) ) { if ( m_name.empty() ) {
return m_entity.getClassName(); return m_entity.getClassName();
} }
return m_name.c_str(); return m_name.c_str();

View File

@ -607,7 +607,7 @@ void VMF_parseBlock( Tokeniser& tokeniser, const VMFBlock& block ){
tokeniser.nextLine(); tokeniser.nextLine();
if ( string_equal( value, "{" ) ) { if ( string_equal( value, "{" ) ) {
VMFBlock::const_iterator i = VMFBlock_find( block, tmp.c_str() ); VMFBlock::const_iterator i = VMFBlock_find( block, tmp.c_str() );
ASSERT_MESSAGE( i != block.end(), "error parsing vmf block " << makeQuoted( block.name() ) << ": unknown block: " << makeQuoted( tmp.c_str() ) ); ASSERT_MESSAGE( i != block.end(), "error parsing vmf block " << makeQuoted( block.name() ) << ": unknown block: " << makeQuoted( tmp ) );
if ( string_equal( tmp.c_str(), "solid" ) ) { if ( string_equal( tmp.c_str(), "solid" ) ) {
++g_vmf_brushes; ++g_vmf_brushes;
} }

View File

@ -458,7 +458,7 @@ bool parseShaderParameters( Tokeniser& tokeniser, ShaderParameters& params ){
bool ShaderTemplate::parseTemplate( Tokeniser& tokeniser ){ bool ShaderTemplate::parseTemplate( Tokeniser& tokeniser ){
m_Name = tokeniser.getToken(); m_Name = tokeniser.getToken();
if ( !parseShaderParameters( tokeniser, m_params ) ) { if ( !parseShaderParameters( tokeniser, m_params ) ) {
globalErrorStream() << "shader template: " << makeQuoted( m_Name.c_str() ) << ": parameter parse failed\n"; globalErrorStream() << "shader template: " << makeQuoted( m_Name ) << ": parameter parse failed\n";
return false; return false;
} }
@ -502,7 +502,7 @@ bool ShaderTemplate::parseDoom3( Tokeniser& tokeniser ){
else if ( currentLayer.m_type == LAYER_SPECULARMAP ) { else if ( currentLayer.m_type == LAYER_SPECULARMAP ) {
m_specular = currentLayer.m_texture; m_specular = currentLayer.m_texture;
} }
else if ( !string_empty( currentLayer.m_texture.c_str() ) ) { else if ( !currentLayer.m_texture.empty() ) {
m_layers.push_back( MapLayerTemplate( m_layers.push_back( MapLayerTemplate(
currentLayer.m_texture.c_str(), currentLayer.m_texture.c_str(),
currentLayer.m_blendFunc, currentLayer.m_blendFunc,
@ -664,7 +664,7 @@ bool ShaderTemplate::parseDoom3( Tokeniser& tokeniser ){
} }
} }
if ( string_empty( m_textureName.c_str() ) ) { if ( m_textureName.empty() ) {
m_textureName = m_diffuse; m_textureName = m_diffuse;
} }
@ -706,18 +706,18 @@ bool parseTemplateInstance( Tokeniser& tokeniser, const char* filename ){
const char* templateName = tokeniser.getToken(); const char* templateName = tokeniser.getToken();
ShaderTemplate* shaderTemplate = findTemplate( templateName ); ShaderTemplate* shaderTemplate = findTemplate( templateName );
if ( shaderTemplate == 0 ) { if ( shaderTemplate == 0 ) {
globalErrorStream() << "shader instance: " << makeQuoted( name.c_str() ) << ": shader template not found: " << makeQuoted( templateName ) << "\n"; globalErrorStream() << "shader instance: " << makeQuoted( name ) << ": shader template not found: " << makeQuoted( templateName ) << "\n";
} }
ShaderArguments args; ShaderArguments args;
if ( !parseShaderParameters( tokeniser, args ) ) { if ( !parseShaderParameters( tokeniser, args ) ) {
globalErrorStream() << "shader instance: " << makeQuoted( name.c_str() ) << ": argument parse failed\n"; globalErrorStream() << "shader instance: " << makeQuoted( name ) << ": argument parse failed\n";
return false; return false;
} }
if ( shaderTemplate != 0 ) { if ( shaderTemplate != 0 ) {
if ( !g_shaderDefinitions.insert( ShaderDefinitionMap::value_type( name, ShaderDefinition( shaderTemplate, args, filename ) ) ).second ) { if ( !g_shaderDefinitions.insert( ShaderDefinitionMap::value_type( name, ShaderDefinition( shaderTemplate, args, filename ) ) ).second ) {
globalErrorStream() << "shader instance: " << makeQuoted( name.c_str() ) << ": already exists, second definition ignored\n"; globalErrorStream() << "shader instance: " << makeQuoted( name ) << ": already exists, second definition ignored\n";
} }
} }
return true; return true;
@ -1092,7 +1092,7 @@ public:
} }
qtexture_t* lightFalloffImage() const { qtexture_t* lightFalloffImage() const {
if ( !string_empty( m_template.m_lightFalloffImage.c_str() ) ) { if ( !m_template.m_lightFalloffImage.empty() ) {
return m_pLightFalloffImage; return m_pLightFalloffImage;
} }
return 0; return 0;
@ -1146,7 +1146,7 @@ void FreeShaders(){
bool ShaderTemplate::parseQuake3( Tokeniser& tokeniser ){ bool ShaderTemplate::parseQuake3( Tokeniser& tokeniser ){
// name of the qtexture_t we'll use to represent this shader (this one has the "textures\" before) // name of the qtexture_t we'll use to represent this shader (this one has the "textures\" before)
m_textureName = m_Name.c_str(); m_textureName = m_Name;
tokeniser.nextLine(); tokeniser.nextLine();
@ -1552,7 +1552,7 @@ void ShaderList_addShaderFile( const char* dirstring ){
{ {
if ( string_equal_nocase( dirstring, sh.c_str() ) ) { if ( string_equal_nocase( dirstring, sh.c_str() ) ) {
found = true; found = true;
globalOutputStream() << "duplicate entry \"" << sh.c_str() << "\" in shaderlist.txt\n"; globalOutputStream() << "duplicate entry \"" << sh << "\" in shaderlist.txt\n";
break; break;
} }
} }
@ -1677,7 +1677,7 @@ void Shaders_Load(){
StringOutputStream shadername( 256 ); StringOutputStream shadername( 256 );
for( const CopiedString& sh : l_shaderfiles ) for( const CopiedString& sh : l_shaderfiles )
{ {
shadername << path.c_str() << sh.c_str(); shadername << path.c_str() << sh;
LoadShaderFile( shadername.c_str() ); LoadShaderFile( shadername.c_str() );
shadername.clear(); shadername.clear();
} }

View File

@ -143,7 +143,7 @@ void QE_CheckAutoSave( void ){
{ {
if ( Map_Unnamed( g_map ) ) { if ( Map_Unnamed( g_map ) ) {
StringOutputStream autosave( 256 ); StringOutputStream autosave( 256 );
autosave << g_qeglobals.m_userGamePath.c_str() << "maps/"; autosave << g_qeglobals.m_userGamePath << "maps/";
Q_mkdir( autosave.c_str() ); Q_mkdir( autosave.c_str() );
autosave << "autosave.map"; autosave << "autosave.map";
Map_SaveFile( autosave.c_str() ); Map_SaveFile( autosave.c_str() );

View File

@ -769,7 +769,7 @@ gboolean project_key_press( GtkWidget* widget, GdkEventKey* event, ProjectList*
else if ( event_is_copy( event ) && x != project.end() ) { else if ( event_is_copy( event ) && x != project.end() ) {
g_buildpair_copied = ( *x ); g_buildpair_copied = ( *x );
} }
else if ( event_is_paste( event ) && string_not_empty( g_buildpair_copied.first.c_str() ) ) { else if ( event_is_paste( event ) && !g_buildpair_copied.first.empty() ) {
projectList->m_changed = true; projectList->m_changed = true;
project.insert( x, g_buildpair_copied ); project.insert( x, g_buildpair_copied );
Build_refreshMenu( g_bsp_menu ); Build_refreshMenu( g_bsp_menu );
@ -1020,7 +1020,7 @@ GtkWindow* BuildMenuDialog_construct( ModalDialog& modal, ProjectList& projectLi
} }
StringOutputStream stream; StringOutputStream stream;
for( Variables::iterator i = g_build_variables.begin(); i != g_build_variables.end(); ++i ){ for( Variables::iterator i = g_build_variables.begin(); i != g_build_variables.end(); ++i ){
stream << "[" << ( *i ).first.c_str() << "] = " << ( *i ).second.c_str() << "\n"; stream << "[" << ( *i ).first << "] = " << ( *i ).second << "\n";
} }
build_clear_variables(); build_clear_variables();
@ -1144,7 +1144,7 @@ const char* g_buildMenuFullPah(){
static StringOutputStream buffer( 256 ); static StringOutputStream buffer( 256 );
buffer.clear(); buffer.clear();
buffer << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << "/" << g_buildMenu.c_str(); buffer << SettingsPath_get() << g_pGameDescription->mGameFile << "/" << g_buildMenu;
return buffer.c_str(); return buffer.c_str();
} }
} }

View File

@ -63,7 +63,7 @@ void GlobalShortcuts_register( const char* name, int type ){
void GlobalShortcuts_reportUnregistered(){ void GlobalShortcuts_reportUnregistered(){
for ( auto& pair : g_shortcuts ) for ( auto& pair : g_shortcuts )
if ( pair.second.accelerator.key != 0 && pair.second.type == 0 ) if ( pair.second.accelerator.key != 0 && pair.second.type == 0 )
globalWarningStream() << "shortcut not registered: " << pair.first.c_str() << "\n"; globalWarningStream() << "shortcut not registered: " << pair.first << "\n";
} }
typedef std::map<CopiedString, Command> Commands; typedef std::map<CopiedString, Command> Commands;

View File

@ -170,10 +170,10 @@ void Model_resolveInheritance( const char* name, Model& model ){
if ( model.m_resolved == false ) { if ( model.m_resolved == false ) {
model.m_resolved = true; model.m_resolved = true;
if ( !string_empty( model.m_parent.c_str() ) ) { if ( !model.m_parent.empty() ) {
Models::iterator i = g_models.find( model.m_parent ); Models::iterator i = g_models.find( model.m_parent );
if ( i == g_models.end() ) { if ( i == g_models.end() ) {
globalErrorStream() << "model " << name << " inherits unknown model " << model.m_parent.c_str() << "\n"; globalErrorStream() << "model " << name << " inherits unknown model " << model.m_parent << "\n";
} }
else else
{ {
@ -512,7 +512,7 @@ static bool EntityClass_parse( EntityClass& entityClass, Tokeniser& tokeniser ){
const char* value; const char* value;
PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, value ) ); PARSE_RETURN_FALSE_IF_FAIL( EntityClassDoom3_parseString( tokeniser, value ) );
if ( string_equal( value, "}" ) ) { // hack for quake4 powerups.def bug if ( string_equal( value, "}" ) ) { // hack for quake4 powerups.def bug
globalErrorStream() << "entityDef " << makeQuoted( entityClass.name() ) << " key " << makeQuoted( tmp.c_str() ) << " has no value\n"; globalErrorStream() << "entityDef " << makeQuoted( entityClass.name() ) << " key " << makeQuoted( tmp ) << " has no value\n";
break; break;
} }
else else
@ -604,7 +604,7 @@ bool EntityClassDoom3_parse( TextInputStream& inputStream, const char* filename
} }
CopiedString tmp( blockType ); CopiedString tmp( blockType );
if ( !EntityClassDoom3_parseBlock( tokeniser, tmp.c_str() ) ) { if ( !EntityClassDoom3_parseBlock( tokeniser, tmp.c_str() ) ) {
globalErrorStream() << GlobalFileSystem().findFile( filename ) << filename << ":" << (unsigned int)tokeniser.getLine() << ": " << tmp.c_str() << " parse failed, skipping rest of file\n"; globalErrorStream() << GlobalFileSystem().findFile( filename ) << filename << ":" << (unsigned int)tokeniser.getLine() << ": " << tmp << " parse failed, skipping rest of file\n";
return false; return false;
} }
} }
@ -656,7 +656,7 @@ void EntityClass_resolveInheritance( EntityClass* derivedClass ){
derivedClass->inheritanceResolved = true; derivedClass->inheritanceResolved = true;
EntityClasses::iterator i = g_EntityClassDoom3_classes.find( derivedClass->m_parent.front().c_str() ); EntityClasses::iterator i = g_EntityClassDoom3_classes.find( derivedClass->m_parent.front().c_str() );
if ( i == g_EntityClassDoom3_classes.end() ) { if ( i == g_EntityClassDoom3_classes.end() ) {
globalErrorStream() << "failed to find entityDef " << makeQuoted( derivedClass->m_parent.front().c_str() ) << " inherited by " << makeQuoted( derivedClass->name() ) << "\n"; globalErrorStream() << "failed to find entityDef " << makeQuoted( derivedClass->m_parent.front() ) << " inherited by " << makeQuoted( derivedClass->name() ) << "\n";
} }
else else
{ {
@ -703,7 +703,7 @@ public:
for ( EntityClasses::iterator i = g_EntityClassDoom3_classes.begin(); i != g_EntityClassDoom3_classes.end(); ++i ) for ( EntityClasses::iterator i = g_EntityClassDoom3_classes.begin(); i != g_EntityClassDoom3_classes.end(); ++i )
{ {
EntityClass_resolveInheritance( ( *i ).second ); EntityClass_resolveInheritance( ( *i ).second );
if ( !string_empty( ( *i ).second->m_modelpath.c_str() ) ) { if ( !( *i ).second->m_modelpath.empty() ) {
Models::iterator j = g_models.find( ( *i ).second->m_modelpath ); Models::iterator j = g_models.find( ( *i ).second->m_modelpath );
if ( j != g_models.end() ) { if ( j != g_models.end() ) {
( *i ).second->m_modelpath = ( *j ).second.m_mesh; ( *i ).second->m_modelpath = ( *j ).second.m_mesh;
@ -716,8 +716,8 @@ public:
usage << "-------- NOTES --------\n"; usage << "-------- NOTES --------\n";
if ( !string_empty( ( *i ).second->m_comments.c_str() ) ) { if ( !( *i ).second->m_comments.empty() ) {
usage << ( *i ).second->m_comments.c_str() << "\n"; usage << ( *i ).second->m_comments << "\n";
} }
usage << "\n-------- KEYS --------\n"; usage << "\n-------- KEYS --------\n";

View File

@ -395,7 +395,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas
tokeniser.nextLine(); tokeniser.nextLine();
StringOutputStream listTypeName( 64 ); StringOutputStream listTypeName( 64 );
listTypeName << entityClass->name() << "_" << attribute.m_name.c_str(); listTypeName << entityClass->name() << "_" << attribute.m_name;
attribute.m_type = listTypeName.c_str(); attribute.m_type = listTypeName.c_str();
ListAttributeType& listType = g_listTypesFGD[listTypeName.c_str()]; ListAttributeType& listType = g_listTypesFGD[listTypeName.c_str()];
@ -429,7 +429,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas
for ( ListAttributeType::const_iterator i = listType.begin(); i != listType.end(); ++i ) for ( ListAttributeType::const_iterator i = listType.begin(); i != listType.end(); ++i )
{ {
if ( string_equal( attribute.m_value.c_str(), ( *i ).first.c_str() ) ) { if ( string_equal( attribute.m_value.c_str(), ( *i ).first.c_str() ) ) {
attribute.m_value = ( *i ).second.c_str(); attribute.m_value = ( *i ).second;
} }
} }
@ -504,7 +504,7 @@ void EntityClassFGD_parseClass( Tokeniser& tokeniser, bool fixedsize, bool isBas
} }
else else
{ {
ERROR_MESSAGE( "unknown key type: " << makeQuoted( type.c_str() ) ); ERROR_MESSAGE( "unknown key type: " << makeQuoted( type ) );
} }
tokeniser.nextLine(); tokeniser.nextLine();
} }
@ -669,7 +669,7 @@ public:
} }
for( const auto& [ name, path ] : name_path ){ for( const auto& [ name, path ] : name_path ){
EntityClassFGD_loadFile( StringOutputStream()( path, name.c_str() ) ); EntityClassFGD_loadFile( StringOutputStream()( path, name ) );
} }
} }
@ -677,7 +677,7 @@ public:
for ( EntityClasses::iterator i = g_EntityClassFGD_classes.begin(); i != g_EntityClassFGD_classes.end(); ++i ) for ( EntityClasses::iterator i = g_EntityClassFGD_classes.begin(); i != g_EntityClassFGD_classes.end(); ++i )
{ {
EntityClassFGD_resolveInheritance( ( *i ).second ); EntityClassFGD_resolveInheritance( ( *i ).second );
if ( ( *i ).second->fixedsize && string_empty( ( *i ).second->m_modelpath.c_str() ) ) { if ( ( *i ).second->fixedsize && ( *i ).second->m_modelpath.empty() ) {
if ( !( *i ).second->sizeSpecified ) { if ( !( *i ).second->sizeSpecified ) {
globalErrorStream() << "size not specified for entity class: " << makeQuoted( ( *i ).second->name() ) << '\n'; globalErrorStream() << "size not specified for entity class: " << makeQuoted( ( *i ).second->name() ) << '\n';
} }

View File

@ -245,7 +245,7 @@ public:
desc = StringRange( data, data + length ); desc = StringRange( data, data + length );
} }
else{ // in case of special symbols, e.g. &quot, &apos, &lt, &gt, &amp, xml writes in a few steps else{ // in case of special symbols, e.g. &quot, &apos, &lt, &gt, &amp, xml writes in a few steps
desc = StringOutputStream()( desc.c_str(), StringRange( data, data + length ) ); desc = StringOutputStream()( desc, StringRange( data, data + length ) );
} }
return m_comment.write( data, length ); return m_comment.write( data, length );

View File

@ -595,12 +595,12 @@ const char* misc_model_dialog( GtkWidget* parent, const char* filepath ){
buffer << root << filepath; buffer << root << filepath;
} }
if( buffer.empty() ){ if( buffer.empty() ){
buffer << g_qeglobals.m_userGamePath.c_str() << "models/"; buffer << g_qeglobals.m_userGamePath << "models/";
if ( !file_readable( buffer.c_str() ) ) { if ( !file_readable( buffer.c_str() ) ) {
// just go to fsmain // just go to fsmain
buffer.clear(); buffer.clear();
buffer << g_qeglobals.m_userGamePath.c_str(); buffer << g_qeglobals.m_userGamePath;
} }
} }

View File

@ -314,12 +314,12 @@ const char* browse_sound( GtkWidget* parent, const char* filepath ){
buffer << root << filepath; buffer << root << filepath;
} }
if( buffer.empty() ){ if( buffer.empty() ){
buffer << g_qeglobals.m_userGamePath.c_str() << "sound/"; buffer << g_qeglobals.m_userGamePath << "sound/";
if ( !file_readable( buffer.c_str() ) ) { if ( !file_readable( buffer.c_str() ) ) {
// just go to fsmain // just go to fsmain
buffer.clear(); buffer.clear();
buffer << g_qeglobals.m_userGamePath.c_str(); buffer << g_qeglobals.m_userGamePath;
} }
} }
@ -1221,9 +1221,9 @@ void EntityInspector_updateKeyValues(){
GtkTreeIter iter; GtkTreeIter iter;
gtk_list_store_append( store, &iter ); gtk_list_store_append( store, &iter );
StringOutputStream key( 64 ); StringOutputStream key( 64 );
key << ( *i ).first.c_str(); key << ( *i ).first;
StringOutputStream value( 64 ); StringOutputStream value( 64 );
value << ( *i ).second.c_str(); value << ( *i ).second;
gtk_list_store_set( store, &iter, 0, key.c_str(), 1, value.c_str(), -1 ); gtk_list_store_set( store, &iter, 0, key.c_str(), 1, value.c_str(), -1 );
} }

View File

@ -186,7 +186,7 @@ const char* environment_get_app_filepath(){
bool portable_app_setup(){ bool portable_app_setup(){
StringOutputStream confdir( 256 ); StringOutputStream confdir( 256 );
confdir << app_path.c_str() << "settings/"; confdir << app_path << "settings/";
if ( file_exists( confdir.c_str() ) ) { if ( file_exists( confdir.c_str() ) ) {
home_path = confdir.c_str(); home_path = confdir.c_str();
return true; return true;

View File

@ -79,7 +79,7 @@ static bool g_bFindActive = true;
namespace namespace
{ {
void FindTextureDialog_apply(){ void FindTextureDialog_apply(){
const auto find = StringOutputStream( 256 )( "textures/", g_FindTextureDialog.m_strFind.c_str() ); const auto find = StringOutputStream( 256 )( "textures/", g_FindTextureDialog.m_strFind );
const auto replace = StringOutputStream( 256 )( "textures/", PathCleaned( g_FindTextureDialog.m_strReplace.c_str() ) ); const auto replace = StringOutputStream( 256 )( "textures/", PathCleaned( g_FindTextureDialog.m_strReplace.c_str() ) );
FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly ); FindReplaceTextures( find.c_str(), replace.c_str(), g_FindTextureDialog.m_bSelectedOnly );
} }

View File

@ -803,7 +803,7 @@ class TextEditor
gtk_widget_set_sensitive( self->m_button, modified ); gtk_widget_set_sensitive( self->m_button, modified );
StringOutputStream str( 256 ); StringOutputStream str( 256 );
str << ( modified? "*" : "" ) << self->m_filename.c_str(); str << ( modified? "*" : "" ) << self->m_filename;
gtk_window_set_title( GTK_WINDOW( self->m_window ), str.c_str() ); gtk_window_set_title( GTK_WINDOW( self->m_window ), str.c_str() );
} }
@ -1074,7 +1074,7 @@ void DoShaderView( const char *shaderFileName, const char *shaderName, bool exte
} }
else{ else{
StringOutputStream command( 256 ); StringOutputStream command( 256 );
command << g_TextEditor_editorCommand.c_str() << " \"" << pathFull.c_str() << "\""; command << g_TextEditor_editorCommand << " \"" << pathFull.c_str() << "\"";
globalOutputStream() << "Launching: " << command.c_str() << "\n"; globalOutputStream() << "Launching: " << command.c_str() << "\n";
// note: linux does not return false if the command failed so it will assume success // note: linux does not return false if the command failed so it will assume success
if ( !Q_Exec( 0, const_cast<char*>( command.c_str() ), 0, true, false ) ) if ( !Q_Exec( 0, const_cast<char*>( command.c_str() ), 0, true, false ) )

View File

@ -119,7 +119,7 @@ void create_game_help_menu( GtkMenu *menu ){
#if 1 #if 1
filename.clear(); filename.clear();
filename << g_pGameDescription->mGameToolsPath.c_str() << "game.xlink"; filename << g_pGameDescription->mGameToolsPath << "game.xlink";
process_xlink( filename.c_str(), g_pGameDescription->getRequiredKeyValue( "name" ), g_pGameDescription->mGameToolsPath.c_str(), menu ); process_xlink( filename.c_str(), g_pGameDescription->getRequiredKeyValue( "name" ), g_pGameDescription->mGameToolsPath.c_str(), menu );
#else #else
for ( std::list<CGameDescription *>::iterator iGame = g_GamesDialog.mGames.begin(); iGame != g_GamesDialog.mGames.end(); ++iGame ) for ( std::list<CGameDescription *>::iterator iGame = g_GamesDialog.mGames.begin(); iGame != g_GamesDialog.mGames.end(); ++iGame )

View File

@ -354,7 +354,7 @@ void paths_init(){
// (for now I had to create symlinks) // (for now I had to create symlinks)
{ {
StringOutputStream path( 256 ); StringOutputStream path( 256 );
path << g_strAppPath.c_str() << "bitmaps/"; path << g_strAppPath << "bitmaps/";
BitmapsPath_set( path.c_str() ); BitmapsPath_set( path.c_str() );
} }
@ -486,7 +486,7 @@ void remove_global_pid(){
*/ */
void create_local_pid(){ void create_local_pid(){
StringOutputStream g_pidGameFile( 256 ); ///< the game-specific .pid file StringOutputStream g_pidGameFile( 256 ); ///< the game-specific .pid file
g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << "/radiant-game.pid"; g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile << "/radiant-game.pid";
FILE *pid = fopen( g_pidGameFile.c_str(), "r" ); FILE *pid = fopen( g_pidGameFile.c_str(), "r" );
if ( pid != 0 ) { if ( pid != 0 ) {
@ -535,7 +535,7 @@ void create_local_pid(){
*/ */
void remove_local_pid(){ void remove_local_pid(){
StringOutputStream g_pidGameFile( 256 ); StringOutputStream g_pidGameFile( 256 );
g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << "/radiant-game.pid"; g_pidGameFile << SettingsPath_get() << g_pGameDescription->mGameFile << "/radiant-game.pid";
remove( g_pidGameFile.c_str() ); remove( g_pidGameFile.c_str() );
} }

View File

@ -252,10 +252,10 @@ void HomePaths_Realise(){
{ {
StringOutputStream path( 256 ); StringOutputStream path( 256 );
path << g_qeglobals.m_userEnginePath.c_str() << gamename_get() << '/'; path << g_qeglobals.m_userEnginePath << gamename_get() << '/';
g_qeglobals.m_userGamePath = path.c_str(); g_qeglobals.m_userGamePath = path.c_str();
} }
ASSERT_MESSAGE( !string_empty( g_qeglobals.m_userGamePath.c_str() ), "HomePaths_Realise: user-game-path is empty" ); ASSERT_MESSAGE( !g_qeglobals.m_userGamePath.empty(), "HomePaths_Realise: user-game-path is empty" );
Q_mkdir( g_qeglobals.m_userGamePath.c_str() ); Q_mkdir( g_qeglobals.m_userGamePath.c_str() );
} }
@ -382,7 +382,7 @@ const char* LocalRcPath_get(){
static CopiedString rc_path; static CopiedString rc_path;
if ( rc_path.empty() ) { if ( rc_path.empty() ) {
StringOutputStream stream( 256 ); StringOutputStream stream( 256 );
stream << GlobalRadiant().getSettingsPath() << g_pGameDescription->mGameFile.c_str() << "/"; stream << GlobalRadiant().getSettingsPath() << g_pGameDescription->mGameFile << "/";
rc_path = stream.c_str(); rc_path = stream.c_str();
} }
return rc_path.c_str(); return rc_path.c_str();
@ -499,11 +499,10 @@ const char* basegame_get(){
} }
const char* gamename_get(){ const char* gamename_get(){
const char* gamename = g_gamename.c_str(); if ( g_gamename.empty() ) {
if ( string_empty( gamename ) ) {
return basegame_get(); return basegame_get();
} }
return gamename; return g_gamename.c_str();
} }
void gamename_set( const char* gamename ){ void gamename_set( const char* gamename ){
@ -2971,14 +2970,14 @@ gboolean toolbar_redirect_scroll( GtkWidget* widget, GdkEventScroll* event, gpoi
void user_shortcuts_init(){ void user_shortcuts_init(){
StringOutputStream path( 256 ); StringOutputStream path( 256 );
path << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << '/'; path << SettingsPath_get() << g_pGameDescription->mGameFile << '/';
LoadCommandMap( path.c_str() ); LoadCommandMap( path.c_str() );
SaveCommandMap( path.c_str() ); SaveCommandMap( path.c_str() );
} }
void user_shortcuts_save(){ void user_shortcuts_save(){
StringOutputStream path( 256 ); StringOutputStream path( 256 );
path << SettingsPath_get() << g_pGameDescription->mGameFile.c_str() << '/'; path << SettingsPath_get() << g_pGameDescription->mGameFile << '/';
SaveCommandMap( path.c_str() ); SaveCommandMap( path.c_str() );
} }

View File

@ -1149,7 +1149,7 @@ void Map_LoadFile( const char *filename ){
} }
globalOutputStream() << "--- LoadMapFile ---\n"; globalOutputStream() << "--- LoadMapFile ---\n";
globalOutputStream() << g_map.m_name.c_str() << "\n"; globalOutputStream() << g_map.m_name << "\n";
globalOutputStream() << Unsigned( g_brushCount.get() + g_patchCount.get() ) << " primitives\n"; globalOutputStream() << Unsigned( g_brushCount.get() + g_patchCount.get() ) << " primitives\n";
globalOutputStream() << Unsigned( g_entityCount.get() ) << " entities\n"; globalOutputStream() << Unsigned( g_entityCount.get() ) << " entities\n";
@ -2446,7 +2446,7 @@ void map_autocaulk_selected(){
str << AppPath_get() << "q3map2." << RADIANT_EXECUTABLE str << AppPath_get() << "q3map2." << RADIANT_EXECUTABLE
<< " -game quake3" << " -game quake3"
<< " -fs_basepath \"" << EnginePath_get() << " -fs_basepath \"" << EnginePath_get()
<< "\" -fs_homepath \"" << g_qeglobals.m_userEnginePath.c_str() << "\" -fs_homepath \"" << g_qeglobals.m_userEnginePath
<< "\" -fs_game " << gamename_get() << "\" -fs_game " << gamename_get()
<< " -autocaulk -fulldetail" << " -autocaulk -fulldetail"
<< " \"" << filename.c_str() << "\""; << " \"" << filename.c_str() << "\"";
@ -2597,9 +2597,9 @@ public:
} }
void realise(){ void realise(){
if ( --m_unrealised == 0 ) { if ( --m_unrealised == 0 ) {
ASSERT_MESSAGE( !string_empty( g_qeglobals.m_userGamePath.c_str() ), "maps_directory: user-game-path is empty" ); ASSERT_MESSAGE( !g_qeglobals.m_userGamePath.empty(), "maps_directory: user-game-path is empty" );
StringOutputStream buffer( 256 ); StringOutputStream buffer( 256 );
buffer << g_qeglobals.m_userGamePath.c_str() << "maps/"; buffer << g_qeglobals.m_userGamePath << "maps/";
Q_mkdir( buffer.c_str() ); Q_mkdir( buffer.c_str() );
g_mapsPath = buffer.c_str(); g_mapsPath = buffer.c_str();
} }

View File

@ -1032,7 +1032,7 @@ gboolean ModelBrowser_button_press( GtkWidget* widget, GdkEventButton* event, Mo
Instance_setSelected( instance, true ); Instance_setSelected( instance, true );
StringOutputStream sstream( 128 ); StringOutputStream sstream( 128 );
sstream << modelBrowser->m_currentFolderPath.c_str() << std::next( modelBrowser->m_currentFolder->m_files.begin(), modelBrowser->m_currentModelId )->c_str(); sstream << modelBrowser->m_currentFolderPath << std::next( modelBrowser->m_currentFolder->m_files.begin(), modelBrowser->m_currentModelId )->c_str();
Node_getEntity( node )->setKeyValue( entityClass->miscmodel_key(), sstream.c_str() ); Node_getEntity( node )->setKeyValue( entityClass->miscmodel_key(), sstream.c_str() );
} }
return FALSE; return FALSE;
@ -1045,7 +1045,7 @@ gboolean ModelBrowser_button_release( GtkWidget* widget, GdkEventButton* event,
} }
if ( event->button == 1 && modelBrowser->m_move_amount < 16 && modelBrowser->m_currentFolder != nullptr && modelBrowser->m_currentModelId >= 0 ) { // assign model to selected entity nodes if ( event->button == 1 && modelBrowser->m_move_amount < 16 && modelBrowser->m_currentFolder != nullptr && modelBrowser->m_currentModelId >= 0 ) { // assign model to selected entity nodes
StringOutputStream sstream( 128 ); StringOutputStream sstream( 128 );
sstream << modelBrowser->m_currentFolderPath.c_str() << std::next( modelBrowser->m_currentFolder->m_files.begin(), modelBrowser->m_currentModelId )->c_str(); sstream << modelBrowser->m_currentFolderPath << std::next( modelBrowser->m_currentFolder->m_files.begin(), modelBrowser->m_currentModelId )->c_str();
class EntityVisitor : public SelectionSystem::Visitor class EntityVisitor : public SelectionSystem::Visitor
{ {
const char* m_filePath; const char* m_filePath;
@ -1100,7 +1100,7 @@ static void TreeView_onRowActivated( GtkTreeView* treeview, GtkTreePath* path, G
{ {
for( const CopiedString& filename : g_ModelBrowser.m_currentFolder->m_files ){ for( const CopiedString& filename : g_ModelBrowser.m_currentFolder->m_files ){
sstream.clear(); sstream.clear();
sstream << g_ModelBrowser.m_currentFolderPath.c_str() << filename.c_str(); sstream << g_ModelBrowser.m_currentFolderPath << filename;
ModelNode *modelNode = new ModelNode; ModelNode *modelNode = new ModelNode;
modelNode->setModel( sstream.c_str() ); modelNode->setModel( sstream.c_str() );
NodeSmartReference node( modelNode->node() ); NodeSmartReference node( modelNode->node() );

View File

@ -319,7 +319,7 @@ static void OnApply( GtkWidget *widget, gpointer data ){
g_PatchInspector.m_Patch->undoSave(); g_PatchInspector.m_Patch->undoSave();
if ( !texdef_name_valid( g_PatchInspector.m_strName.c_str() ) ) { if ( !texdef_name_valid( g_PatchInspector.m_strName.c_str() ) ) {
globalErrorStream() << "invalid texture name '" << g_PatchInspector.m_strName.c_str() << "'\n"; globalErrorStream() << "invalid texture name '" << g_PatchInspector.m_strName << "'\n";
g_PatchInspector.m_strName = texdef_name_default(); g_PatchInspector.m_strName = texdef_name_default();
} }
g_PatchInspector.m_Patch->SetShader( g_PatchInspector.m_strName.c_str() ); g_PatchInspector.m_Patch->SetShader( g_PatchInspector.m_strName.c_str() );

View File

@ -93,11 +93,11 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile
{ {
StringOutputStream path( 256 ); StringOutputStream path( 256 );
path << AppPath_get() << gameFile.c_str() << "/"; path << AppPath_get() << gameFile << "/";
mGameToolsPath = path.c_str(); mGameToolsPath = path.c_str();
} }
ASSERT_MESSAGE( file_exists( mGameToolsPath.c_str() ), "game directory not found: " << makeQuoted( mGameToolsPath.c_str() ) ); ASSERT_MESSAGE( file_exists( mGameToolsPath.c_str() ), "game directory not found: " << makeQuoted( mGameToolsPath ) );
mGameFile = gameFile; mGameFile = gameFile;
@ -116,10 +116,10 @@ CGameDescription::CGameDescription( xmlDocPtr pDoc, const CopiedString& gameFile
} }
void CGameDescription::Dump(){ void CGameDescription::Dump(){
globalOutputStream() << "game description file: " << makeQuoted( mGameFile.c_str() ) << "\n"; globalOutputStream() << "game description file: " << makeQuoted( mGameFile ) << "\n";
for ( GameDescription::iterator i = m_gameDescription.begin(); i != m_gameDescription.end(); ++i ) for ( GameDescription::iterator i = m_gameDescription.begin(); i != m_gameDescription.end(); ++i )
{ {
globalOutputStream() << ( *i ).first.c_str() << " = " << makeQuoted( ( *i ).second.c_str() ) << "\n"; globalOutputStream() << ( *i ).first << " = " << makeQuoted( ( *i ).second ) << "\n";
} }
} }

View File

@ -204,7 +204,7 @@ public:
if ( i != m_gameDescription.end() ) { if ( i != m_gameDescription.end() ) {
return ( *i ).second.c_str(); return ( *i ).second.c_str();
} }
ERROR_MESSAGE( "game attribute " << makeQuoted( key ) << " not found in " << makeQuoted( mGameFile.c_str() ) ); ERROR_MESSAGE( "game attribute " << makeQuoted( key ) << " not found in " << makeQuoted( mGameFile ) );
return ""; return "";
} }

View File

@ -348,7 +348,7 @@ struct ModelResource : public Resource
if ( realised() ) { if ( realised() ) {
unrealise(); unrealise();
} }
ASSERT_MESSAGE( !realised(), "ModelResource::~ModelResource: resource reference still realised: " << makeQuoted( m_name.c_str() ) ); ASSERT_MESSAGE( !realised(), "ModelResource::~ModelResource: resource reference still realised: " << makeQuoted( m_name ) );
} }
// NOT COPYABLE // NOT COPYABLE
ModelResource( const ModelResource& ) = delete; ModelResource( const ModelResource& ) = delete;
@ -475,8 +475,8 @@ struct ModelResource : public Resource
} }
std::time_t modified() const { std::time_t modified() const {
StringOutputStream fullpath( 256 ); StringOutputStream fullpath( 256 );
fullpath << m_path.c_str() << m_name.c_str(); fullpath << m_path << m_name;
return file_modified( fullpath.c_str() ); return file_modified( fullpath );
} }
void mapSave(){ void mapSave(){
m_modified = modified(); m_modified = modified();

View File

@ -1173,7 +1173,7 @@ public:
~OpenGLShaderCache(){ ~OpenGLShaderCache(){
for ( Shaders::iterator i = m_shaders.begin(); i != m_shaders.end(); ++i ) for ( Shaders::iterator i = m_shaders.begin(); i != m_shaders.end(); ++i )
{ {
globalOutputStream() << "leaked shader: " << makeQuoted( ( *i ).key.c_str() ) << "\n"; globalOutputStream() << "leaked shader: " << makeQuoted( ( *i ).key ) << "\n";
} }
} }
Shader* capture( const char* name ){ Shader* capture( const char* name ){

View File

@ -341,12 +341,12 @@ void qtexture_realise( qtexture_t& texture, const TextureKey& key ){
texture.contentFlags = image->getContentFlags(); texture.contentFlags = image->getContentFlags();
texture.value = image->getValue(); texture.value = image->getValue();
image->release(); image->release();
globalOutputStream() << "Loaded Texture: \"" << key.second.c_str() << "\"\n"; globalOutputStream() << "Loaded Texture: \"" << key.second << "\"\n";
GlobalOpenGL_debugAssertNoErrors(); GlobalOpenGL_debugAssertNoErrors();
} }
else else
{ {
globalErrorStream() << "Texture load failed: \"" << key.second.c_str() << "\"\n"; globalErrorStream() << "Texture load failed: \"" << key.second << "\"\n";
} }
} }
} }

View File

@ -1962,7 +1962,7 @@ void TextureBrowser_checkTagFile(){
else else
{ {
// load default tagfile // load default tagfile
auto default_filename = StringOutputStream( 256 )( g_pGameDescription->mGameToolsPath.c_str(), SHADERTAG_FILE ); auto default_filename = StringOutputStream( 256 )( g_pGameDescription->mGameToolsPath, SHADERTAG_FILE );
if ( file_exists( default_filename ) ) { if ( file_exists( default_filename ) ) {
g_TextureBrowser.m_tags = TagBuilder.OpenXmlDoc( default_filename, rc_filename ); g_TextureBrowser.m_tags = TagBuilder.OpenXmlDoc( default_filename, rc_filename );
@ -2452,7 +2452,7 @@ void TextureBrowser_copyTag(){
void TextureBrowser_pasteTag(){ void TextureBrowser_pasteTag(){
IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() ); IShader* ishader = QERApp_Shader_ForName( g_TextureBrowser.shader.c_str() );
CopiedString shader = g_TextureBrowser.shader.c_str(); const CopiedString shader = g_TextureBrowser.shader;
if ( !TagBuilder.CheckShaderTag( shader.c_str() ) ) { if ( !TagBuilder.CheckShaderTag( shader.c_str() ) ) {
CopiedString shaderFile = ishader->getShaderFileName(); CopiedString shaderFile = ishader->getShaderFileName();
@ -2593,8 +2593,8 @@ void TextureBrowser_filter_searchFromStart(){
void TextureBrowser_exportTitle( const StringImportCallback& importer ){ void TextureBrowser_exportTitle( const StringImportCallback& importer ){
StringOutputStream buffer( 64 ); StringOutputStream buffer( 64 );
buffer << "Textures: "; buffer << "Textures: ";
if ( !string_empty( g_TextureBrowser_currentDirectory.c_str() ) ) { if ( !g_TextureBrowser_currentDirectory.empty() ) {
buffer << g_TextureBrowser_currentDirectory.c_str(); buffer << g_TextureBrowser_currentDirectory;
} }
else else
{ {

View File

@ -308,7 +308,7 @@ public:
else else
{ {
Operation* operation = m_undo_stack.back(); Operation* operation = m_undo_stack.back();
globalOutputStream() << "Undo: " << operation->m_command.c_str() << "\n"; globalOutputStream() << "Undo: " << operation->m_command << "\n";
startRedo(); startRedo();
trackersUndo(); trackersUndo();
@ -324,7 +324,7 @@ public:
else else
{ {
Operation* operation = m_redo_stack.back(); Operation* operation = m_redo_stack.back();
globalOutputStream() << "Redo: " << operation->m_command.c_str() << "\n"; globalOutputStream() << "Redo: " << operation->m_command << "\n";
startUndo(); startUndo();
trackersRedo(); trackersRedo();

View File

@ -1344,12 +1344,12 @@ void BackgroundImage::render( const VIEWTYPE viewtype ){
const char* BackgroundImage::background_image_dialog(){ const char* BackgroundImage::background_image_dialog(){
StringOutputStream buffer( 1024 ); StringOutputStream buffer( 1024 );
buffer << g_qeglobals.m_userGamePath.c_str() << "textures/"; buffer << g_qeglobals.m_userGamePath << "textures/";
if ( !file_readable( buffer.c_str() ) ) { if ( !file_readable( buffer.c_str() ) ) {
// just go to fsmain // just go to fsmain
buffer.clear(); buffer.clear();
buffer << g_qeglobals.m_userGamePath.c_str(); buffer << g_qeglobals.m_userGamePath;
} }
const char *filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, "Background Image", buffer.c_str() ); const char *filename = file_dialog( GTK_WIDGET( MainFrame_getWindow() ), true, "Background Image", buffer.c_str() );

View File

@ -195,10 +195,10 @@ void vfsInitDirectory( const char *path ){
const char *ext = path_get_filename_base_end( name ); const char *ext = path_get_filename_base_end( name );
if ( striEqual( ext, ".pk3" ) ) { if ( striEqual( ext, ".pk3" ) ) {
paks.push_back( StringOutputStream( 256 )( pathCleaned.c_str(), name ) ); paks.push_back( StringOutputStream( 256 )( pathCleaned, name ) );
} }
else if ( striEqual( ext, ".pk3dir" ) ) { else if ( striEqual( ext, ".pk3dir" ) ) {
g_strDirs.emplace_back( StringOutputStream( 256 )( pathCleaned.c_str(), name, '/' ) ); g_strDirs.emplace_back( StringOutputStream( 256 )( pathCleaned, name, '/' ) );
} }
} }
g_dir_close( dir ); g_dir_close( dir );
@ -229,7 +229,7 @@ std::vector<CopiedString> vfsListShaderFiles( const char *shaderPath ){
}; };
/* search in dirs */ /* search in dirs */
for ( const auto& strdir : g_strDirs ){ for ( const auto& strdir : g_strDirs ){
GDir *dir = g_dir_open( StringOutputStream( 256 )( strdir.c_str(), shaderPath, "/" ), 0, NULL ); GDir *dir = g_dir_open( StringOutputStream( 256 )( strdir, shaderPath, "/" ), 0, NULL );
if ( dir != NULL ) { if ( dir != NULL ) {
const char* name; const char* name;

View File

@ -646,9 +646,9 @@ int pk3BSPMain( int argc, char **argv ){
} }
/* make a pack */ /* make a pack */
auto packname = StringOutputStream( 256 )( g_enginePath, nameOFmap.c_str(), "_autopacked.pk3" ); auto packname = StringOutputStream( 256 )( g_enginePath, nameOFmap, "_autopacked.pk3" );
remove( packname ); remove( packname );
auto packFailName = StringOutputStream( 256 )( g_enginePath, nameOFmap.c_str(), "_FAILEDpack.pk3" ); auto packFailName = StringOutputStream( 256 )( g_enginePath, nameOFmap, "_FAILEDpack.pk3" );
remove( packFailName ); remove( packFailName );
Sys_Printf( "\n--- ZipZip ---\n" ); Sys_Printf( "\n--- ZipZip ---\n" );
@ -712,7 +712,7 @@ int pk3BSPMain( int argc, char **argv ){
Sys_Printf( "\n\t.bsp and stuff\n" ); Sys_Printf( "\n\t.bsp and stuff\n" );
stream( "maps/", nameOFmap.c_str(), ".bsp" ); stream( "maps/", nameOFmap, ".bsp" );
//if ( vfsPackFile( stream, packname, compLevel ) ){ //if ( vfsPackFile( stream, packname, compLevel ) ){
if ( vfsPackFile_Absolute_Path( source, stream, packname, compLevel ) ){ if ( vfsPackFile_Absolute_Path( source, stream, packname, compLevel ) ){
Sys_Printf( "++%s\n", stream.c_str() ); Sys_Printf( "++%s\n", stream.c_str() );
@ -722,15 +722,15 @@ int pk3BSPMain( int argc, char **argv ){
packFAIL = true; packFAIL = true;
} }
stream( "maps/", nameOFmap.c_str(), ".aas" ); stream( "maps/", nameOFmap, ".aas" );
if ( !packResource( stream, packname, compLevel ) ) if ( !packResource( stream, packname, compLevel ) )
Sys_Printf( " ~fail %s\n", stream.c_str() ); Sys_Printf( " ~fail %s\n", stream.c_str() );
stream( "scripts/", nameOFmap.c_str(), ".arena" ); stream( "scripts/", nameOFmap, ".arena" );
if ( !packResource( stream, packname, compLevel ) ) if ( !packResource( stream, packname, compLevel ) )
Sys_Printf( " ~fail %s\n", stream.c_str() ); Sys_Printf( " ~fail %s\n", stream.c_str() );
stream( "scripts/", nameOFmap.c_str(), ".defi" ); stream( "scripts/", nameOFmap, ".defi" );
if ( !packResource( stream, packname, compLevel ) ) if ( !packResource( stream, packname, compLevel ) )
Sys_Printf( " ~fail %s\n", stream.c_str() ); Sys_Printf( " ~fail %s\n", stream.c_str() );
@ -1387,14 +1387,14 @@ int repackBSPMain( int argc, char **argv ){
} }
/* write shader */ /* write shader */
stream( g_enginePath, nameOFrepack.c_str(), "_strippedBYrepacker.shader" ); stream( g_enginePath, nameOFrepack, "_strippedBYrepacker.shader" );
FILE *f = fopen( stream, "wb" ); FILE *f = fopen( stream, "wb" );
fwrite( allShaders, sizeof( char ), allShaders.end() - allShaders.begin(), f ); fwrite( allShaders, sizeof( char ), allShaders.end() - allShaders.begin(), f );
fclose( f ); fclose( f );
Sys_Printf( "Shaders saved to %s\n", stream.c_str() ); Sys_Printf( "Shaders saved to %s\n", stream.c_str() );
/* make a pack */ /* make a pack */
stream( g_enginePath, nameOFrepack.c_str(), "_repacked.pk3" ); stream( g_enginePath, nameOFrepack, "_repacked.pk3" );
remove( stream ); remove( stream );
Sys_Printf( "\n--- ZipZip ---\n" ); Sys_Printf( "\n--- ZipZip ---\n" );

View File

@ -219,7 +219,7 @@ struct AssModel
const CopiedString oldShader( m_shader ); const CopiedString oldShader( m_shader );
if( strchr( m_shader.c_str(), '/' ) == nullptr ){ /* texture is likely in the folder, where model is */ if( strchr( m_shader.c_str(), '/' ) == nullptr ){ /* texture is likely in the folder, where model is */
m_shader = StringOutputStream()( rootPath, m_shader.c_str() ); m_shader = StringOutputStream()( rootPath, m_shader );
} }
else{ else{
const char *name = m_shader.c_str(); const char *name = m_shader.c_str();

View File

@ -2029,7 +2029,7 @@ void LoadShaderInfo( void ){
/* parse the shader files */ /* parse the shader files */
for ( const CopiedString& file : shaderFiles ) for ( const CopiedString& file : shaderFiles )
{ {
ParseShaderFile( StringOutputStream( 64 )( g_game->shaderPath, '/', file.c_str() ) ); ParseShaderFile( StringOutputStream( 64 )( g_game->shaderPath, '/', file ) );
} }
/* emit some statistics */ /* emit some statistics */