Fix unregistered function failure including <nscp> on Linux

fixes #9394
This commit is contained in:
Michael Friedrich 2015-06-15 10:26:42 +02:00
parent 2f27edbaae
commit 9ada3dd5be
2 changed files with 4 additions and 6 deletions

View File

@ -57,9 +57,7 @@ REGISTER_SCRIPTFUNCTION(bool, &ScriptUtils::CastBool);
REGISTER_SCRIPTFUNCTION(get_time, &Utility::GetTime); REGISTER_SCRIPTFUNCTION(get_time, &Utility::GetTime);
REGISTER_SCRIPTFUNCTION(basename, &Utility::BaseName); REGISTER_SCRIPTFUNCTION(basename, &Utility::BaseName);
REGISTER_SCRIPTFUNCTION(dirname, &Utility::DirName); REGISTER_SCRIPTFUNCTION(dirname, &Utility::DirName);
#ifdef _WIN32
REGISTER_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim); REGISTER_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim);
#endif /* _WIN32 */
String ScriptUtils::CastString(const Value& value) String ScriptUtils::CastString(const Value& value)
{ {
@ -286,9 +284,9 @@ void ScriptUtils::Assert(const Value& arg)
BOOST_THROW_EXCEPTION(std::runtime_error("Assertion failed")); BOOST_THROW_EXCEPTION(std::runtime_error("Assertion failed"));
} }
#ifdef _WIN32
String ScriptUtils::MsiGetComponentPathShim(const String& component) String ScriptUtils::MsiGetComponentPathShim(const String& component)
{ {
#ifdef _WIN32
TCHAR productCode[39]; TCHAR productCode[39];
if (MsiGetProductCode(component.CStr(), productCode) != ERROR_SUCCESS) if (MsiGetProductCode(component.CStr(), productCode) != ERROR_SUCCESS)
return ""; return "";
@ -297,5 +295,7 @@ String ScriptUtils::MsiGetComponentPathShim(const String& component)
path[0] = '\0'; path[0] = '\0';
MsiGetComponentPath(productCode, component.CStr(), path, &szPath); MsiGetComponentPath(productCode, component.CStr(), path, &szPath);
return path; return path;
} #else /* _WIN32 */
return String();
#endif /* _WIN32 */ #endif /* _WIN32 */
}

View File

@ -50,9 +50,7 @@ public:
static DynamicObject::Ptr GetObject(const Type::Ptr& type, const String& name); static DynamicObject::Ptr GetObject(const Type::Ptr& type, const String& name);
static Array::Ptr GetObjects(const Type::Ptr& type); static Array::Ptr GetObjects(const Type::Ptr& type);
static void Assert(const Value& arg); static void Assert(const Value& arg);
#ifdef _WIN32
static String MsiGetComponentPathShim(const String& component); static String MsiGetComponentPathShim(const String& component);
#endif /* _WIN32 */
private: private:
ScriptUtils(void); ScriptUtils(void);