37 lines
984 B
C++
37 lines
984 B
C++
#include "foobar2000.h"
|
|
|
|
bool component_installation_validator::test_my_name(const char * fn) {
|
|
const char * path = core_api::get_my_full_path();
|
|
path += pfc::scan_filename(path);
|
|
bool retVal = ( strcmp(path, fn) == 0 );
|
|
PFC_ASSERT( retVal );
|
|
return retVal;
|
|
}
|
|
bool component_installation_validator::have_other_file(const char * fn) {
|
|
for(int retry = 0;;) {
|
|
pfc::string_formatter path = core_api::get_my_full_path();
|
|
path.truncate(path.scan_filename());
|
|
path << fn;
|
|
try {
|
|
try {
|
|
bool v = filesystem::g_exists(path, fb2k::noAbort);
|
|
PFC_ASSERT( v );
|
|
return v;
|
|
} catch(std::exception const & e) {
|
|
FB2K_console_formatter() << "Component integrity check error: " << e << " (on: " << fn << ")";
|
|
throw;
|
|
}
|
|
} catch(exception_io_denied) {
|
|
|
|
} catch(exception_io_sharing_violation) {
|
|
|
|
} catch(exception_io_file_corrupted) { // happens
|
|
return false;
|
|
} catch(...) {
|
|
uBugCheck();
|
|
}
|
|
if (++retry == 10) uBugCheck();
|
|
Sleep(100);
|
|
}
|
|
}
|