Skip to content

Commit

Permalink
Fix crash when config folder doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cathery committed Apr 19, 2021
1 parent 99f6f0c commit cf8d6d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/Sysmodule/source/log.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "switch.h"
#include "log.h"
#include "config_handler.h"
#include <sys/stat.h>
#include <stratosphere.hpp>

static ams::os::Mutex printMutex(false);
Expand Down Expand Up @@ -35,6 +35,8 @@ void WriteToLog(const char *fmt, ...)

ams::TimeSpan ts = ams::os::ConvertToTimeSpan(ams::os::GetSystemTick());

mkdir(CONFIG_PATH, 777);

FILE *fp = fopen(LOG_PATH, "a");

//Print time
Expand Down
1 change: 1 addition & 0 deletions source/Sysmodule/source/log.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "config_handler.h"

#define LOG_PATH CONFIG_PATH "log.txt"

Expand Down

0 comments on commit cf8d6d5

Please sign in to comment.