From a5e2adedf38f84a8be5e8d844e02991d3bbfecca Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 29 Oct 2018 22:07:17 +0100 Subject: Move files, expose include dir --- include/FileUtil.hpp | 21 ----------------- include/dchat/FileUtil.hpp | 21 +++++++++++++++++ include/dchat/env.hpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++ include/env.hpp | 59 ---------------------------------------------- project.conf | 3 +++ src/Cache.cpp | 2 +- src/FileUtil.cpp | 4 ++-- src/Gif.cpp | 2 +- 8 files changed, 87 insertions(+), 84 deletions(-) delete mode 100644 include/FileUtil.hpp create mode 100644 include/dchat/FileUtil.hpp create mode 100644 include/dchat/env.hpp delete mode 100644 include/env.hpp diff --git a/include/FileUtil.hpp b/include/FileUtil.hpp deleted file mode 100644 index cb4e308..0000000 --- a/include/FileUtil.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "dchat/StringView.hpp" -#include -#include - -namespace dchat -{ - class FileException : public std::runtime_error - { - public: - FileException(const std::string &errMsg) : std::runtime_error(errMsg) {} - }; - - // Throws FileException on error. - // Returned value is allocated with malloc and should be free'd by caller. - StringView getFileContent(const boost::filesystem::path &filepath); - - // Throws FileException on error - void fileReplace(const boost::filesystem::path &filepath, const StringView data); -} diff --git a/include/dchat/FileUtil.hpp b/include/dchat/FileUtil.hpp new file mode 100644 index 0000000..097b607 --- /dev/null +++ b/include/dchat/FileUtil.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "StringView.hpp" +#include +#include + +namespace dchat +{ + class FileException : public std::runtime_error + { + public: + FileException(const std::string &errMsg) : std::runtime_error(errMsg) {} + }; + + // Throws FileException on error. + // Returned value is allocated with malloc and should be free'd by caller. + StringView getFileContent(const boost::filesystem::path &filepath); + + // Throws FileException on error + void fileReplace(const boost::filesystem::path &filepath, const StringView data); +} diff --git a/include/dchat/env.hpp b/include/dchat/env.hpp new file mode 100644 index 0000000..4061518 --- /dev/null +++ b/include/dchat/env.hpp @@ -0,0 +1,59 @@ +#pragma once + +#define OS_FAMILY_WINDOWS 0 +#define OS_FAMILY_POSIX 1 + +#define OS_TYPE_WINDOWS 0 +#define OS_TYPE_LINUX 1 + +#if defined(_WIN32) || defined(_WIN64) + #if defined(_WIN64) + #define SYS_ENV_64BIT + #else + #define SYS_ENV_32BIT + #endif + #define OS_FAMILY OS_FAMILY_WINDOWS + #define OS_TYPE OS_TYPE_WINDOWS + + #ifndef UNICODE + #define UNICODE + #endif + + #ifndef _UNICODE + #define _UNICODE + #endif + + #ifndef WIN32_LEAN_AND_MEAN + #define WIN32_LEAN_AND_MEAN + #endif + + #include +#endif + +#if defined(__linux__) || defined(__unix__) || defined(__APPLE__) || defined(_POSIX_VERSION) + #define OS_FAMILY OS_FAMILY_POSIX +#endif + +#if defined(__linux__) || defined(__CYGWIN__) + #define OS_TYPE OS_TYPE_LINUX +#endif + +#if defined(__GNUC__) + #if defined(__x86_64__) || defined(__pc64__) + #define SYS_ENV_64BIT + #else + #define SYS_ENV_32BIT + #endif +#endif + +#if !defined(SYS_ENV_32BIT) && !defined(SYS_ENV_64BIT) + #error "System is not detected as either 32-bit or 64-bit" +#endif + +#if !defined(OS_FAMILY) + #error "System not supported. Only Windows and Posix systems supported right now" +#endif + +#if !defined(OS_TYPE) + #error "System not supported. Only Windows and linux systems supported right now" +#endif diff --git a/include/env.hpp b/include/env.hpp deleted file mode 100644 index 4061518..0000000 --- a/include/env.hpp +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#define OS_FAMILY_WINDOWS 0 -#define OS_FAMILY_POSIX 1 - -#define OS_TYPE_WINDOWS 0 -#define OS_TYPE_LINUX 1 - -#if defined(_WIN32) || defined(_WIN64) - #if defined(_WIN64) - #define SYS_ENV_64BIT - #else - #define SYS_ENV_32BIT - #endif - #define OS_FAMILY OS_FAMILY_WINDOWS - #define OS_TYPE OS_TYPE_WINDOWS - - #ifndef UNICODE - #define UNICODE - #endif - - #ifndef _UNICODE - #define _UNICODE - #endif - - #ifndef WIN32_LEAN_AND_MEAN - #define WIN32_LEAN_AND_MEAN - #endif - - #include -#endif - -#if defined(__linux__) || defined(__unix__) || defined(__APPLE__) || defined(_POSIX_VERSION) - #define OS_FAMILY OS_FAMILY_POSIX -#endif - -#if defined(__linux__) || defined(__CYGWIN__) - #define OS_TYPE OS_TYPE_LINUX -#endif - -#if defined(__GNUC__) - #if defined(__x86_64__) || defined(__pc64__) - #define SYS_ENV_64BIT - #else - #define SYS_ENV_32BIT - #endif -#endif - -#if !defined(SYS_ENV_32BIT) && !defined(SYS_ENV_64BIT) - #error "System is not detected as either 32-bit or 64-bit" -#endif - -#if !defined(OS_FAMILY) - #error "System not supported. Only Windows and Posix systems supported right now" -#endif - -#if !defined(OS_TYPE) - #error "System not supported. Only Windows and linux systems supported right now" -#endif diff --git a/project.conf b/project.conf index 7bfa3b1..a705bed 100644 --- a/project.conf +++ b/project.conf @@ -4,6 +4,9 @@ type = "dynamic" version = "0.1.0" platforms = ["any"] +[config] +expose_include_dirs = ["include"] + [dependencies] tiny-process = "2" boost-filesystem = "1.66" diff --git a/src/Cache.cpp b/src/Cache.cpp index 0bde89d..712a716 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -1,6 +1,6 @@ #include "../include/dchat/Cache.hpp" #include "../include/env.hpp" -#include "../include/FileUtil.hpp" +#include "../include/dchat/FileUtil.hpp" #include "../include/dchat/Gif.hpp" #include #include diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index 08efd00..d464288 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -1,5 +1,5 @@ -#include "../include/FileUtil.hpp" -#include "../include/env.hpp" +#include "../include/dchat/FileUtil.hpp" +#include "../include/dchat/env.hpp" #include namespace dchat diff --git a/src/Gif.cpp b/src/Gif.cpp index 0c52f7d..2391872 100644 --- a/src/Gif.cpp +++ b/src/Gif.cpp @@ -1,5 +1,5 @@ #include "../include/dchat/Gif.hpp" -#include "../include/FileUtil.hpp" +#include "../include/dchat/FileUtil.hpp" using namespace std; -- cgit v1.2.3