OpenCPN Partial API docs
safe_mode.cpp
1 #include <cstdio>
2 #include <string>
3 #include <fstream>
4 
5 #include <wx/dialog.h>
6 #include <wx/filename.h>
7 #include <wx/sizer.h>
8 
9 #include "model/base_platform.h"
10 #include "model/cmdline.h"
11 #include "model/ocpn_utils.h"
12 #include "model/safe_mode.h"
13 
14 namespace safe_mode {
15 
16 #ifdef _WIN32
17 static std::string SEP("\\");
18 #else
19 static std::string SEP("/");
20 #endif
21 
22 
23 bool safe_mode = false;
24 
25 std::string check_file_path() {
26  std::string path = g_BasePlatform->GetPrivateDataDir().ToStdString();
27  path += SEP;
28  path += "startcheck.dat";
29  return path;
30 }
31 
32 void set_mode(bool mode) {
33  safe_mode = mode;
34  g_bdisable_opengl = g_bdisable_opengl || mode;
35 }
36 
37 bool get_mode() { return safe_mode; }
38 
39 
41 void clear_check() { remove(check_file_path().c_str()); }
42 
43 } // namespace safe_mode
wxString & GetPrivateDataDir()
Return dir path for opencpn.log, etc., respecting -c cli option.
Global variables reflecting command line options and arguments.
Safe mode handling.
Definition: safe_mode.cpp:14
void clear_check()
Mark last run as successful.
Definition: safe_mode.cpp:41