#include "utils.h"
#include "path_manager.h"
+#include "log.h"
int main(int argc, char* argv[])
{
- if (initializePathManager(std::string(), std::string(), std::string())) {
- fprintf(stderr, "Fail to initialize PathManager\n");
+ PathManager* __pm = nullptr;
+ try {
+ __pm = new PathManager();
+ } catch (const std::exception& e) {
+ _SERR("Failed to create PathManager");
return -1;
}
- std::string tpaList = getTPA();
- std::ofstream out(PLATFORM_TPA_CACHE);
- out << tpaList;
- out.close();
+ std::string tpaList;
+ addAssembliesFromDirectories(__pm->getPlatformAssembliesPaths(), tpaList);
+
+ if (!isSymlinkFile(PLATFORM_TPA_CACHE)) {
+ std::ofstream out(PLATFORM_TPA_CACHE);
+ out << tpaList;
+ out.close();
+ } else {
+ _SERR("Failed to create platform_tpa_cache. Symbolic link is detected");
+ return -1;
+ }
+
+ delete(__pm);
+ __pm = nullptr;
return 0;
}