Move the function used to obtain the log file path into AppInfo::logFilePath() since it will be application-specific.

This commit is contained in:
Robert Knight 2011-08-26 18:40:23 +01:00
parent 8b757692b1
commit dc741814c9
6 changed files with 13 additions and 8 deletions

7
src/AppInfo.cpp Normal file
View file

@ -0,0 +1,7 @@
#include "AppInfo.h"
std::string AppInfo::logFilePath()
{
return "update-log.txt";
}

View file

@ -5,8 +5,11 @@
class AppInfo class AppInfo
{ {
public: public:
// Basic application information
static std::string name(); static std::string name();
static std::string appName(); static std::string appName();
static std::string logFilePath();
}; };
inline std::string AppInfo::name() inline std::string AppInfo::name()

View file

@ -23,6 +23,7 @@ endif()
add_definitions(-DTIXML_USE_STL) add_definitions(-DTIXML_USE_STL)
set (SOURCES set (SOURCES
AppInfo.cpp
DirIterator.cpp DirIterator.cpp
FileOps.cpp FileOps.cpp
Log.cpp Log.cpp

View file

@ -80,9 +80,3 @@ void Log::write(Type type, const char* text)
} }
} }
std::string Log::defaultPath()
{
std::string path = "update-log.txt";
return path;
}

View file

@ -22,7 +22,6 @@ class Log
void write(Type type, const char* text); void write(Type type, const char* text);
static Log* instance(); static Log* instance();
static std::string defaultPath();
private: private:
static void writeToStream(std::ostream& stream, Type type, const char* text); static void writeToStream(std::ostream& stream, Type type, const char* text);

View file

@ -1,3 +1,4 @@
#include "AppInfo.h"
#include "Log.h" #include "Log.h"
#include "Platform.h" #include "Platform.h"
#include "ProcessUtils.h" #include "ProcessUtils.h"
@ -51,7 +52,7 @@ void runUpdaterThread(void* arg)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
Log::instance()->open(Log::defaultPath()); Log::instance()->open(AppInfo::logFilePath());
UpdaterOptions options; UpdaterOptions options;
options.parse(argc,argv); options.parse(argc,argv);