forward path slashes entered in surface inspector, find/replace dialog::replace

This commit is contained in:
Garux 2020-05-05 12:31:53 +03:00
parent d48ce73d01
commit 13f877b7db
2 changed files with 4 additions and 2 deletions

View File

@ -45,6 +45,7 @@
#include "gtkutil/window.h" #include "gtkutil/window.h"
#include "stream/stringstream.h" #include "stream/stringstream.h"
#include "os/path.h"
#include "commands.h" #include "commands.h"
#include "dialog.h" #include "dialog.h"
@ -92,7 +93,7 @@ void FindTextureDialog_apply(){
StringOutputStream replace( 256 ); StringOutputStream replace( 256 );
find << "textures/" << g_FindTextureDialog.m_strFind.c_str(); find << "textures/" << g_FindTextureDialog.m_strFind.c_str();
replace << "textures/" << g_FindTextureDialog.m_strReplace.c_str(); replace << "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

@ -51,6 +51,7 @@
#include "texturelib.h" #include "texturelib.h"
#include "shaderlib.h" #include "shaderlib.h"
#include "stringio.h" #include "stringio.h"
#include "os/path.h"
#include "gtkutil/idledraw.h" #include "gtkutil/idledraw.h"
#include "gtkutil/dialog.h" #include "gtkutil/dialog.h"
@ -1381,7 +1382,7 @@ void SurfaceInspector::Update(){
*/ */
void SurfaceInspector::ApplyShader(){ void SurfaceInspector::ApplyShader(){
StringOutputStream name( 256 ); StringOutputStream name( 256 );
name << GlobalTexturePrefix_get() << gtk_entry_get_text( m_texture ); name << GlobalTexturePrefix_get() << PathCleaned( gtk_entry_get_text( m_texture ) );
// TTimo: detect and refuse invalid texture names (at least the ones with spaces) // TTimo: detect and refuse invalid texture names (at least the ones with spaces)
if ( !texdef_name_valid( name.c_str() ) ) { if ( !texdef_name_valid( name.c_str() ) ) {