Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions build/windows/win32/PolycodeStudio/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ void registerFileType(String extension, String progId, String app, String defaul

}

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){

ChangeWindowMessageFilter(WM_COPYDATA,MSGFLT_ADD);

Expand All @@ -56,6 +55,13 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi

fileName = fileName.replace("\\", "/");

String arg;
for (int i = 1; i < nArgs; i++) {
arg = String(szArglist[i]);
if (arg == "-d" || arg == "--debug")
Logger::getInstance()->setLogToFile(true);
}

// check if an instance of Polycode is running and bring it up and open file if needed
HWND runningHwnd = FindWindow(L"POLYCODEAPPLICATION", L"Polycode");
if(runningHwnd) {
Expand Down
11 changes: 7 additions & 4 deletions src/core/PolyLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,16 @@ void Logger::setLogToFile(bool val){
time_t t = time(NULL);
char mbstr[100];
if (strftime(mbstr, sizeof(mbstr), "%y_%m_%d.log", localtime(&t))) {
logFile = fopen((const char*)mbstr, "w");
logFile = fopen((const char*)mbstr, "a");
} else {
logFile = fopen("poly.log", "w");
logFile = fopen("poly.log", "a");
}
strftime(mbstr, sizeof(mbstr), "%y_%m_%d %H:%M", localtime(&t));
logToFile = val;
Logger::log("== Starting Logging %s ==\n\n", mbstr);
} else {
logToFile = val;
}

logToFile = val;
}

void Logger::setLogFile(FILE *f){
Expand Down