working on more efficient Linux usb detection

This commit is contained in:
Chris Danford
2003-12-16 07:25:12 +00:00
parent d5abb2b0c8
commit 597e5e69da
+6 -6
View File
@@ -16,6 +16,8 @@
#include "RageLog.h" #include "RageLog.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "ScreenManager.h" #include "ScreenManager.h"
# include <stdio.h>
# include <sys/stat.h>
MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program MemoryCardManager* MEMCARDMAN = NULL; // global and accessable from anywhere in our program
@@ -242,23 +244,21 @@ bool UsbChanged()
// disconnected. Use this as a trivial check. // disconnected. Use this as a trivial check.
static const CString VAR_LOG_MESSAGES = "/var/log/messages"; static const CString VAR_LOG_MESSAGES = "/var/log/messages";
static bool bFirstTime = false; static bool bFirstTime = false;
static _stat old_stat; static stat old_stat;
if( bFirstTime ) if( bFirstTime )
{ {
_fstat(VAR_LOG_MESSAGES, &old_stat); fstat(VAR_LOG_MESSAGES, &old_stat);
bFirstTime = false; bFirstTime = false;
return true; return true;
} }
else else
{ {
_stat new_stat; stat new_stat;
_fstat(VAR_LOG_MESSAGES, &new_stat); fstat(VAR_LOG_MESSAGES, &new_stat);
bool bChanged = old_stat != new_stat; bool bChanged = old_stat != new_stat;
old_stat = new_stat; old_stat = new_stat;
return bChanged; return bChanged;
} }
#elif defined(_WINDOWS)
return false;
#else #else
return false; return false;
#endif #endif