| | |
| | | #include <sstream> |
| | | #include <string> |
| | | |
| | | #include <build_properties.h> |
| | | #include <licensecc/datatypes.h> |
| | | |
| | | #include "../base/logger.h" |
| | | #include "../api/datatypes.h" |
| | | #include "../base/base.h" |
| | | #include "../base/EventRegistry.h" |
| | | #include "../base/FileUtils.hpp" |
| | |
| | | namespace locate { |
| | | using namespace std; |
| | | |
| | | ApplicationFolder::ApplicationFolder() : |
| | | LocatorStrategy("ApplicationFolder") { |
| | | ApplicationFolder::ApplicationFolder() : LocatorStrategy("ApplicationFolder") {} |
| | | |
| | | } |
| | | ApplicationFolder::~ApplicationFolder() {} |
| | | |
| | | ApplicationFolder::~ApplicationFolder() { |
| | | } |
| | | |
| | | const vector<string> ApplicationFolder::licenseLocations( |
| | | EventRegistry &eventRegistry) const { |
| | | const vector<string> ApplicationFolder::license_locations(EventRegistry &eventRegistry) { |
| | | vector<string> diskFiles; |
| | | char fname[MAX_PATH] = { 0 }; |
| | | char fname[MAX_PATH] = {0}; |
| | | const FUNCTION_RETURN fret = getModuleName(fname); |
| | | cout << string(fname) << endl; |
| | | cout << fret << endl; |
| | | if (fret == FUNC_RET_OK) { |
| | | const string temptativeLicense = string(fname) + ".lic"; |
| | | const string module_name = remove_extension(fname); |
| | | const string temptativeLicense = string(module_name) + ".lic"; |
| | | ifstream f(temptativeLicense.c_str()); |
| | | if (f.good()) { |
| | | diskFiles.push_back(temptativeLicense); |
| | | eventRegistry.addEvent((EVENT_TYPE) LICENSE_FILE_FOUND, |
| | | (SEVERITY) SVRT_INFO, temptativeLicense); |
| | | eventRegistry.addEvent(LICENSE_FOUND, temptativeLicense.c_str()); |
| | | } else { |
| | | eventRegistry.addEvent(LICENSE_FILE_NOT_FOUND, SVRT_WARN, |
| | | temptativeLicense); |
| | | eventRegistry.addEvent(LICENSE_FILE_NOT_FOUND, temptativeLicense.c_str()); |
| | | } |
| | | f.close(); |
| | | } else { |
| | |
| | | return diskFiles; |
| | | } |
| | | |
| | | } |
| | | } // namespace locate |
| | | } /* namespace license */ |