summaryrefslogtreecommitdiffstats
path: root/src/Bindings/Plugin.cpp
blob: 3f16451886a5b6dd7a26ac2c0432a109aeeac75c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

#include "Globals.h"  // NOTE: MSVC stupidness requires this to be the same across all modules

#include "Plugin.h"





cPlugin::cPlugin(const AString & a_FolderName) :
	m_Status(cPluginManager::psDisabled),
	m_Name(a_FolderName),
	m_Version(0),
	m_FolderName(a_FolderName)
{
}





cPlugin::~cPlugin()
{
	LOGD("Destroying plugin \"%s\".", m_Name.c_str());
}





void cPlugin::Unload(void)
{
	auto pm = cPluginManager::Get();
	pm->RemovePluginCommands(this);
	pm->RemovePluginConsoleCommands(this);
	pm->RemoveHooks(this);
	OnDisable();
	m_Status = cPluginManager::psUnloaded;
	m_LoadError.clear();
}





AString cPlugin::GetLocalFolder(void) const
{
	return "Plugins" + cFile::GetPathSeparator() + m_FolderName;
}





void cPlugin::SetLoadError(const AString & a_LoadError)
{
	m_Status = cPluginManager::psError;
	m_LoadError = a_LoadError;
}