OpenCPN Partial API docs
Loading...
Searching...
No Matches
safe_mode.cpp
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2022 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
16 **************************************************************************/
17
24#include <cstdio>
25#include <string>
26#include <fstream>
27
28#include <wx/dialog.h>
29#include <wx/filename.h>
30#include <wx/sizer.h>
31
32#include "model/base_platform.h"
33#include "model/cmdline.h"
34#include "model/ocpn_utils.h"
35#include "model/safe_mode.h"
36
37namespace safe_mode {
38
39#ifdef _WIN32
40static std::string SEP("\\");
41#else
42static std::string SEP("/");
43#endif
44
45bool safe_mode = false;
46
47std::string check_file_path() {
48 std::string path = g_BasePlatform->GetPrivateDataDir().ToStdString();
49 path += SEP;
50 path += "startcheck.dat";
51 return path;
52}
53
54void set_mode(bool mode) {
55 safe_mode = mode;
56 g_bdisable_opengl = g_bdisable_opengl || mode;
57}
58
59bool get_mode() { return safe_mode; }
60
62void clear_check() { remove(check_file_path().c_str()); }
63
64} // namespace safe_mode
BasePlatform * g_BasePlatform
points to g_platform, handles brain-dead MS linker.
Basic platform specific support utilities without GUI deps.
wxString & GetPrivateDataDir()
Return dir path for opencpn.log, etc., respecting -c cli option.
Global variables reflecting command line options and arguments.
Safe mode GUI handling.
Definition safe_mode.cpp:37
void clear_check()
Mark last run as successful.
Definition safe_mode.cpp:62
Miscellaneous utilities, many of which string related.
Safe mode non-gui handling.