]> granicus.if.org Git - icinga2/commitdiff
Fix unregistered function failure including <nscp> on Linux
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 15 Jun 2015 08:26:42 +0000 (10:26 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 15 Jun 2015 08:30:13 +0000 (10:30 +0200)
fixes #9394

lib/base/scriptutils.cpp
lib/base/scriptutils.hpp

index 1ac249fbf7773ac3993ec2526c1b4ee8655c0c84..e51430cce5ae13d476e047de6724fa873e9f38d6 100644 (file)
@@ -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 */
+}
index 15bf1169daf9cd141c4262025f7d4582c49062b5..9005d8bcb12bc6998f5b6cb315f86766f37d64c2 100644 (file)
@@ -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);