diff --git a/xwords4/android/jni/andutils.c b/xwords4/android/jni/andutils.c index 6d92ab83a..a1548c6b5 100644 --- a/xwords4/android/jni/andutils.c +++ b/xwords4/android/jni/andutils.c @@ -979,7 +979,11 @@ void android_debugff(const char* func, const char* file, const char* fmt, ...) { char buf[256]; - snprintf( buf, sizeof(buf), "%s:%s(): %s", file, func, fmt ); + const char* shortPath = 1 + strrchr(file, '/'); + if ( !shortPath ) { + shortPath = file; + } + snprintf( buf, sizeof(buf), "%s:%s(): %s", shortPath, func, fmt ); va_list ap; va_start( ap, fmt ); diff --git a/xwords4/linux/Makefile b/xwords4/linux/Makefile index 3bd6b7a99..a1949aa32 100644 --- a/xwords4/linux/Makefile +++ b/xwords4/linux/Makefile @@ -251,6 +251,8 @@ ifdef USE_SQLITE LIBS += -lsqlite3 LIBS += -lmosquitto DEFINES += -DUSE_SQLITE +DEFINES += -DSHORTFILE=\"$(notdir $<)\" + endif # Turn this off for now. I apparently have a memory problem, but it # doesn't make the app unusable for testing while crash on boot does. diff --git a/xwords4/linux/xptypes.h b/xwords4/linux/xptypes.h index 49fc3d059..f5f8d7e1d 100644 --- a/xwords4/linux/xptypes.h +++ b/xwords4/linux/xptypes.h @@ -77,12 +77,17 @@ extern void linux_debugf(const char*, ...) __attribute__ ((format (printf, 1, 2))); # define XP_DEBUGF(...) linux_debugf(__VA_ARGS__) + +#ifndef SHORTFILE +# define SHORTFILE __FILE__ +#endif + extern void linux_debugff(const char* func, const char* file, int line, const char* fmt, ...) __attribute__ ((format (printf, 4, 5))); # define XP_LOGFF( FMT, ... ) \ - linux_debugff( __func__, __FILE__, __LINE__, FMT, ##__VA_ARGS__ ) + linux_debugff( __func__, SHORTFILE, __LINE__, FMT, ##__VA_ARGS__ ) #define XP_LOG(STR) \ - linux_debugff( __func__, __FILE__, "%s", STR ) + linux_debugff( __func__, SHORTFILE, "%s", STR ) #else # define XP_DEBUGF(ch,...)