Fix script debugging when server is running on Linux

the script paths were wrong, on Linux they were like
"pak000.pk4/script/doom_util.script" while on Windows it's only
"script/doom_util.script".
Fixed idFileSystemLocal::OSPathToRelativePath() to skip ...pk4/

also fixed GCC compile error in Common.cpp
This commit is contained in:
Daniel Gibson 2021-06-14 04:58:13 +02:00
parent 07da116640
commit 40fa8a7dfa
3 changed files with 20 additions and 6 deletions

View file

@ -2408,8 +2408,12 @@ void idCommonLocal::Frame( void ) {
InitSIMD();
}
if ( com_enableDebuggerServer.IsModified( ) ) {
com_enableDebuggerServer.GetBool( ) ? DebuggerServerInit( ) : DebuggerServerShutdown( );
if ( com_enableDebuggerServer.IsModified() ) {
if ( com_enableDebuggerServer.GetBool() ) {
DebuggerServerInit();
} else {
DebuggerServerShutdown();
}
}
eventLoop->RunEventLoop();

View file

@ -886,10 +886,20 @@ const char *idFileSystemLocal::OSPathToRelativePath( const char *OSPath ) {
}
if ( base ) {
s = strstr( base, "/" );
if ( !s ) {
s = strstr( base, "\\" );
// DG: on Windows base might look like "base\\pak008.pk4/script/doom_util.script"
// while on Linux it'll be more like "base/pak008.pk4/script/doom_util.script"
// I /think/ we want to get rid of the bla.pk4 part, at least that's what happens implicitly on Windows
// (I hope these problems don't exist if the file is not from a .pk4, so that case is handled like before)
s = strstr( base, ".pk4/" );
if ( s != NULL ) {
s += 4; // skip ".pk4", but *not* the following '/', that'll be skipped below
} else {
s = strchr( base, '/' );
if ( s == NULL ) {
s = strchr( base, '\\' );
}
}
if ( s ) {
strcpy( relativePath, s + 1 );
if ( fs_debug.GetInteger() > 1 ) {

View file

@ -110,7 +110,7 @@ bool rvDebuggerServer::Initialize ( void )
void rvDebuggerServer::OSPathToRelativePath( const char *osPath, idStr &qpath )
{
if ( strchr( osPath, ':' ) )
if ( strchr( osPath, ':' ) ) // XXX: what about linux?
{
qpath = fileSystem->OSPathToRelativePath( osPath );
}