Skip to content

Commit

Permalink
Added offline logging to /EdiZon/EdiZon.log instead of nxlink, if the…
Browse files Browse the repository at this point in the history
… file exists
  • Loading branch information
WerWolv committed Jul 26, 2018
1 parent 6ab40b5 commit b29e852
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
VERSION_MAJOR := 1
VERSION_MINOR := 3
VERSION_MICRO := 0
VERSION_MICRO := 1

APP_TITLE := EdiZon
APP_AUTHOR := WerWolv and thomasnet
Expand Down
15 changes: 15 additions & 0 deletions source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#include <vector>
#include <algorithm>

#include <iostream>
#include <unistd.h>
#include <fcntl.h>

#include "gui.hpp"
#include "gui_main.hpp"
#include "gui_editor.hpp"
Expand Down Expand Up @@ -55,6 +59,15 @@ int main(int argc, char** argv) {
nxlinkStdio();
#endif

int file = open("/EdiZon/EdiZon.log", O_APPEND | O_WRONLY);

if (file >= 0) {
fflush(stdout);
dup2(file, STDOUT_FILENO);
fflush(stderr);
dup2(file, STDERR_FILENO);
}

gfxInitDefault();
setsysInitialize();
ColorSetId colorSetId;
Expand Down Expand Up @@ -144,6 +157,8 @@ int main(int argc, char** argv) {
Title::g_titles.clear();
Account::g_accounts.clear();

close(file);

socketExit();
gfxExit();

Expand Down

0 comments on commit b29e852

Please sign in to comment.