Building with clean SGPath API
This commit is contained in:
@@ -36,9 +36,10 @@
|
||||
#include <simgear/threads/SGQueue.hxx>
|
||||
#include <simgear/threads/SGGuard.hxx>
|
||||
|
||||
#include <simgear/misc/sgstream.hxx>
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
|
||||
#if defined (SG_WINDOWS)
|
||||
#if defined (SG_WINDOWS)
|
||||
// for AllocConsole, OutputDebugString
|
||||
#include <windows.h>
|
||||
#endif
|
||||
@@ -106,10 +107,10 @@ void LogCallback::setLogLevels( sgDebugClass c, sgDebugPriority p )
|
||||
class FileLogCallback : public simgear::LogCallback
|
||||
{
|
||||
public:
|
||||
FileLogCallback(const std::string& aPath, sgDebugClass c, sgDebugPriority p) :
|
||||
simgear::LogCallback(c, p),
|
||||
m_file(aPath.c_str(), std::ios_base::out | std::ios_base::trunc)
|
||||
FileLogCallback(const SGPath& aPath, sgDebugClass c, sgDebugPriority p) :
|
||||
simgear::LogCallback(c, p)
|
||||
{
|
||||
m_file.open(aPath, std::ios_base::out | std::ios_base::trunc);
|
||||
}
|
||||
|
||||
virtual void operator()(sgDebugClass c, sgDebugPriority p,
|
||||
@@ -120,7 +121,7 @@ public:
|
||||
<< ":" << file << ":" << line << ":" << message << std::endl;
|
||||
}
|
||||
private:
|
||||
std::ofstream m_file;
|
||||
sg_ofstream m_file;
|
||||
};
|
||||
|
||||
class StderrLogCallback : public simgear::LogCallback
|
||||
@@ -232,7 +233,7 @@ public:
|
||||
// attach failed, don't install the callback
|
||||
addStderr = false;
|
||||
}
|
||||
|
||||
|
||||
if (!isFile) {
|
||||
// No - OK! now set streams to attached console
|
||||
freopen("conout$", "w", stdout);
|
||||
@@ -443,7 +444,7 @@ sglog()
|
||||
void
|
||||
logstream::logToFile( const SGPath& aPath, sgDebugClass c, sgDebugPriority p )
|
||||
{
|
||||
global_privateLogstream->addCallback(new FileLogCallback(aPath.str(), c, p));
|
||||
global_privateLogstream->addCallback(new FileLogCallback(aPath, c, p));
|
||||
}
|
||||
|
||||
namespace simgear
|
||||
|
||||
Reference in New Issue
Block a user