| 26 | |
| 27 | |
| 28 | void init() { |
| 29 | if (!settings::autoCheckUpdates) |
| 30 | return; |
| 31 | // Dev mode is typically used when Rack or plugins are compiled from source, so updating might overwrite assets. |
| 32 | if (settings::devMode) |
| 33 | return; |
| 34 | // Safe mode disables plugin loading, so Rack will unnecessarily try to sync all plugins. |
| 35 | if (settings::safeMode) |
| 36 | return; |
| 37 | |
| 38 | std::thread t([&]() { |
| 39 | system::setThreadName("Library"); |
| 40 | // Wait a few seconds before updating in case library is destroyed immediately afterwards |
| 41 | { |
| 42 | std::unique_lock<std::mutex> lock(timeoutMutex); |
| 43 | if (updateCv.wait_for(lock, std::chrono::duration<double>(4.0)) != std::cv_status::timeout) |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | checkAppUpdate(); |
| 48 | checkUpdates(); |
| 49 | }); |
| 50 | t.detach(); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | void destroy() { |
nothing calls this directly
no test coverage detected