commit 285322e950b58cb6fe4d22c9811a71dd08f3f1af
parent 6a0058b9543ee82c6a31b103a6882a150aec1b72
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 15 Feb 2016 21:53:27 -0500
register a simulation of reapack's own package on startup
Diffstat:
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/src/reapack.cpp b/src/reapack.cpp
@@ -76,6 +76,8 @@ ReaPack::ReaPack(REAPER_PLUGIN_HINSTANCE instance)
if(m_config->isFirstRun())
manageRemotes();
+ registerSelf();
+
#ifdef _WIN32
CleanupTempFiles();
#endif
@@ -345,3 +347,27 @@ void ReaPack::runTasks()
if(m_transaction)
m_transaction->runTasks();
}
+
+void ReaPack::registerSelf()
+{
+ // hard-coding galore!
+ RemoteIndex ri("ReaPack");
+ Category cat("Extensions", &ri);
+ Package pkg(Package::ExtensionType, "ReaPack.ext", &cat);
+ Version ver(REAPACK_VERSION, &pkg);
+ ver.addSource(new Source(Source::GenericPlatform,
+ REAPACK_FILE, "dummy url", &ver));
+
+ try {
+ Registry reg(Path::prefixCache(Path::REGISTRY_FILE));
+ reg.push(&ver);
+ reg.commit();
+ }
+ catch(const reapack_error &e) {
+ char msg[4096] = {};
+ sprintf(msg,
+ "ReaPack could not register itself! Please report this.\n\n"
+ "Error description: %s", e.what());
+ ShowMessageBox(msg, "ReaPack", MB_OK);
+ }
+}
diff --git a/src/reapack.hpp b/src/reapack.hpp
@@ -68,6 +68,7 @@ public:
private:
Transaction *createTransaction();
bool hitchhikeTransaction();
+ void registerSelf();
std::map<int, ActionCallback> m_actions;