mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
logging fix
This commit is contained in:
@@ -50,6 +50,12 @@
|
||||
ReferencedContainer = "container:AerofoilMac.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "-diagnostics"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
@@ -235,8 +235,6 @@ void GpFileSystem_X::Init()
|
||||
int created = mkdir(prefsPath.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
|
||||
}
|
||||
SDL_free(prefsDir);
|
||||
|
||||
printf("Base path %s \n", m_basePath.c_str());
|
||||
}
|
||||
|
||||
bool GpFileSystem_X::FileExists(PortabilityLayer::VirtualDirectory_t virtualDirectory, const char *path)
|
||||
|
@@ -20,7 +20,7 @@ void GpLogDriver_X::Init()
|
||||
|
||||
void GpLogDriver_X::VPrintf(Category category, const char *fmt, va_list args)
|
||||
{
|
||||
size_t fmtSize = 0;
|
||||
size_t fmtSize = 0;
|
||||
bool hasFormatting = false;
|
||||
for (const char *fmtCheck = fmt; *fmtCheck; fmtCheck++)
|
||||
{
|
||||
@@ -64,6 +64,10 @@ void GpLogDriver_X::VPrintf(Category category, const char *fmt, va_list args)
|
||||
}
|
||||
else
|
||||
{
|
||||
//a copy is needed if using va_list multiple times (otherwise unexpected output)
|
||||
va_list args_copy;
|
||||
va_copy(args_copy, args);
|
||||
|
||||
int formattedSize = vsnprintf(nullptr, 0, fmt, args);
|
||||
if (formattedSize <= 0)
|
||||
return;
|
||||
@@ -72,7 +76,8 @@ void GpLogDriver_X::VPrintf(Category category, const char *fmt, va_list args)
|
||||
if (!charBuff)
|
||||
return;
|
||||
|
||||
vsnprintf(charBuff, formattedSize + 1, fmt, args);
|
||||
vsnprintf(charBuff, formattedSize + 1, fmt, args_copy);
|
||||
va_end(args_copy);
|
||||
|
||||
if (m_stream)
|
||||
m_stream->Write(charBuff, formattedSize);
|
||||
|
@@ -15,24 +15,9 @@ struct IGpLogDriver
|
||||
virtual void VPrintf(Category category, const char *fmt, va_list args) = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
#ifdef __MACOS__
|
||||
template <typename C, typename F, typename... T>
|
||||
void Printf(C category, F *fmt, T... t);
|
||||
#else
|
||||
void Printf(Category category, const char *fmt, ...);
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
//this is temp, but args lose their types for some reason, garbling output
|
||||
#ifdef __MACOS__
|
||||
template <typename C, typename F, typename... T>
|
||||
inline void IGpLogDriver::Printf(C category, F *fmt, T... t)
|
||||
{
|
||||
printf(fmt, t...);
|
||||
printf("\n");
|
||||
}
|
||||
#else
|
||||
inline void IGpLogDriver::Printf(Category category, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
@@ -40,4 +25,3 @@ inline void IGpLogDriver::Printf(Category category, const char *fmt, ...)
|
||||
this->VPrintf(category, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user