Clean up the IsAbsolutePath patch

refs #5168
This commit is contained in:
Gunnar Beutner 2017-04-27 05:31:44 +02:00
parent c087f40e0b
commit d03d09160a
2 changed files with 14 additions and 9 deletions

View File

@ -27,7 +27,7 @@
#include <fstream> #include <fstream>
#ifdef _WIN32 #ifdef _WIN32
#include "Shlwapi.h" # include <shlwapi.h>
#endif /* _WIN32 */ #endif /* _WIN32 */
using namespace icinga; using namespace icinga;
@ -354,3 +354,14 @@ bool ConfigCompiler::HasZoneConfigAuthority(const String& zoneName)
return !empty; return !empty;
} }
bool ConfigCompiler::IsAbsolutePath(const String& path)
{
#ifndef _WIN32
return (path.GetLength() > 0 && path[0] == '/');
#else /* _WIN32 */
return !PathIsRelative(path.CStr());
#endif /* _WIN32 */
}

View File

@ -127,14 +127,6 @@ public:
static bool HasZoneConfigAuthority(const String& zoneName); static bool HasZoneConfigAuthority(const String& zoneName);
static inline bool IsAbsolutePath(const String& path) {
#ifndef _WIN32
return (path.GetLength() > 0 && path[0] == '/');
#else
return !PathIsRelative(path.CStr());
#endif /* _WIN32 */
}
private: private:
boost::promise<boost::shared_ptr<Expression> > m_Promise; boost::promise<boost::shared_ptr<Expression> > m_Promise;
@ -154,6 +146,8 @@ private:
static void HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector<Expression *>& expressions); static void HandleIncludeZone(const String& relativeBase, const String& tag, const String& path, const String& pattern, const String& package, std::vector<Expression *>& expressions);
static bool IsAbsolutePath(const String& path);
public: public:
bool m_Eof; bool m_Eof;
int m_OpenBraces; int m_OpenBraces;