//#include "stdafx.h"
#include <tchar.h>
#include "opEnv.h"
#include <windows.h>
void* opEnv::m_instance = nullptr;
TString opEnv::m_basePath;
TString opEnv::m_opName;
int opEnv::m_showErrorMsg = 1;

void opEnv::setInstance(void* instance)
{
	m_instance = instance;
	TCHAR buff[512] = {};
	::GetModuleFileName(static_cast<HINSTANCE>(m_instance), buff, 512);
	TString s(buff);
	size_t index = s.rfind(_T("\\"));
	if (index != s.npos) {
		m_basePath = s.substr(0, index);
		m_opName = s.substr(index + 1);
	}
}

void* opEnv::getInstance()
{
	return m_instance;
}

TString opEnv::getBasePath() 
{
	return m_basePath;
}

TString opEnv::getOpName() {
	return m_opName;
}