From 228e1a11a2b622603cbb593fcb6b617ed0a489c8 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 15 Jun 2015 10:26:42 +0200 Subject: [PATCH] Fix unregistered function failure including on Linux fixes #9394 --- lib/base/scriptutils.cpp | 8 ++++---- lib/base/scriptutils.hpp | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index 1ac249fbf..e51430cce 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -56,9 +56,7 @@ REGISTER_SAFE_SCRIPTFUNCTION(bool, &ScriptUtils::CastBool); REGISTER_SAFE_SCRIPTFUNCTION(get_time, &Utility::GetTime); REGISTER_SAFE_SCRIPTFUNCTION(basename, &Utility::BaseName); REGISTER_SAFE_SCRIPTFUNCTION(dirname, &Utility::DirName); -#ifdef _WIN32 REGISTER_SAFE_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim); -#endif /* _WIN32 */ String ScriptUtils::CastString(const Value& value) { @@ -272,9 +270,9 @@ void ScriptUtils::Assert(const Value& arg) BOOST_THROW_EXCEPTION(std::runtime_error("Assertion failed")); } -#ifdef _WIN32 String ScriptUtils::MsiGetComponentPathShim(const String& component) { +#ifdef _WIN32 TCHAR productCode[39]; if (MsiGetProductCode(component.CStr(), productCode) != ERROR_SUCCESS) return ""; @@ -283,5 +281,7 @@ String ScriptUtils::MsiGetComponentPathShim(const String& component) path[0] = '\0'; MsiGetComponentPath(productCode, component.CStr(), path, &szPath); return path; -} +#else /* _WIN32 */ + return String(); #endif /* _WIN32 */ +} diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp index 15bf1169d..9005d8bcb 100644 --- a/lib/base/scriptutils.hpp +++ b/lib/base/scriptutils.hpp @@ -50,9 +50,7 @@ public: static DynamicObject::Ptr GetObject(const Type::Ptr& type, const String& name); static Array::Ptr GetObjects(const Type::Ptr& type); static void Assert(const Value& arg); -#ifdef _WIN32 static String MsiGetComponentPathShim(const String& component); -#endif /* _WIN32 */ private: ScriptUtils(void);