Civ backgrounds for minimap
[0ad.git] / source / ps / scripting / JSInterface_UserReport.cpp
blobb6bd37f20f73a867ceb08e05e8fdbfaa1024f086
1 /* Copyright (C) 2021 Wildfire Games.
2 * This file is part of 0 A.D.
4 * 0 A.D. 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.
9 * 0 A.D. 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.
14 * You should have received a copy of the GNU General Public License
15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
18 #include "precompiled.h"
20 #include "JSInterface_UserReport.h"
22 #include "ps/Filesystem.h"
23 #include "ps/Pyrogenesis.h"
24 #include "ps/UserReport.h"
25 #include "scriptinterface/FunctionWrapper.h"
26 #include "scriptinterface/ScriptRequest.h"
28 #include <string>
30 namespace JSI_UserReport
32 bool IsUserReportEnabled()
34 return g_UserReporter.IsReportingEnabled();
37 void SetUserReportEnabled(bool enabled)
39 g_UserReporter.SetReportingEnabled(enabled);
42 std::string GetUserReportStatus()
44 return g_UserReporter.GetStatus();
47 std::string GetUserReportLogPath()
49 return psLogDir().string8();
52 std::string GetUserReportConfigPath()
54 OsPath configPath;
55 WARN_IF_ERR(g_VFS->GetDirectoryRealPath("config/", configPath));
56 return configPath.string8();
59 void RegisterScriptFunctions(const ScriptRequest& rq)
61 ScriptFunction::Register<&IsUserReportEnabled>(rq, "IsUserReportEnabled");
62 ScriptFunction::Register<&SetUserReportEnabled>(rq, "SetUserReportEnabled");
63 ScriptFunction::Register<&GetUserReportStatus>(rq, "GetUserReportStatus");
64 ScriptFunction::Register<&GetUserReportLogPath>(rq, "GetUserReportLogPath");
65 ScriptFunction::Register<&GetUserReportConfigPath>(rq, "GetUserReportConfigPath");