// This function returns the number of plug-in classes this DLL //TODO: Must change this number when adding a new class __declspec( dllexport ) int LibNumberClasses() { // Has conflict exit now. if (foundOlderReleaseConflict > 0) { return 0; } else if ( foundOlderReleaseConflict < 0 ) { foundOlderReleaseConflict = 0; // Check for older releases if ( (classDescEnabled[CD_Import] && nullptr != GetModuleHandle(TEXT("MaxNifImport.dli"))) || (classDescEnabled[CD_Export] && nullptr != GetModuleHandle(TEXT("NifExport.dle"))) || (classDescEnabled[CD_Furniture] && nullptr != GetModuleHandle(TEXT("NifFurniture.dlo"))) || (classDescEnabled[CD_Props] && nullptr != GetModuleHandle(TEXT("NifProps.dlu"))) ) { foundOlderReleaseConflict = 1; } else { // do more aggressive access search now in case we are loaded after them TCHAR filename[MAX_PATH]; GetModuleFileName(hInstance, filename, MAX_PATH); if (classDescEnabled[CD_Import] && -1 != _taccess(PathMerge(filename, TEXT("MaxNifImport.dli")), 0)) foundOlderReleaseConflict = 1; else if (classDescEnabled[CD_Export] && -1 != _taccess(PathMerge(filename, TEXT("NifExport.dle")), 0)) foundOlderReleaseConflict = 1; else if (classDescEnabled[CD_Furniture] && -1 != _taccess(PathMerge(filename, TEXT("NifFurniture.dlo")), 0)) foundOlderReleaseConflict = 1; else if (classDescEnabled[CD_Props] && -1 != _taccess(PathMerge(filename, TEXT("NifProps.dlu")), 0)) foundOlderReleaseConflict = 1; } if (foundOlderReleaseConflict > 0) { TCHAR buffer[512]; _stprintf(buffer, TEXT("An older release of the Niftools Max Plugins was found.\n\n") TEXT("Please remove the following files from your 3dsmax\\plugins directory:\n") TEXT("%s%s%s%s") TEXT("The current version will be disabled.") , classDescEnabled[CD_Import] ? TEXT("\tMaxNifImport.dli\n") : TEXT("") , classDescEnabled[CD_Export] ? TEXT("\tNifExport.dle\n") : TEXT("") , classDescEnabled[CD_Furniture] ? TEXT("\tNifFurniture.dlo\n") : TEXT("") , classDescEnabled[CD_Props] ? TEXT("\tNifProps.dlu\n\n") : TEXT("") ); ::MessageBox( nullptr , buffer , TEXT("Niftools Max Plugins") , MB_ICONSTOP|MB_OK ); return 0; } } return nClasses; }
void FastDup::AddDirectoryTree(const char *path) { std::string v = path; char tmp[PATH_MAX+1]; if (path[0] != '/') { char cwd[PATH_MAX + 1]; if (!getcwd(cwd, PATH_MAX + 1)) throw std::runtime_error("Unable to get current directory"); v = PathMerge(cwd, v); } PathResolve(tmp, sizeof(tmp), v.c_str()); if (!DirectoryExists(tmp)) throw std::runtime_error("Path does not exist or is not a directory"); DirList.push_back(tmp); }