SET_TARGET_PROPERTIES(${CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
INSTALL(TARGETS ${CLIENT} DESTINATION ${LIB_INSTALL_DIR})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
CONFIGURE_FILE(${CLIENT}.pc.in ${CLIENT}.pc @ONLY)
INSTALL(FILES ${CLIENT}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
#define MODES_NAMESPACE_USE using namespace ModeSupervisorNamespace
#ifndef MODES_PLUGIN_DEFAULT_DIR
-#define MODES_PLUGIN_DEFAULT_DIR "/usr/lib/modes-plugins/"
+#define MODES_PLUGIN_DEFAULT_DIR "/usr/lib/modes-plugins"
#warning "MODES_PLUGIN_DEFAULT_DIR is redefined"
#endif
#define MODES_PLUGIN_LIB_PREFIX "libmodes-plugin"
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <stdio.h>
#include <libxml/tree.h>
#include <libxml/xmlschemas.h>
#include "Action.h"
return;
}
-void XMLGenerator::saveToFile(const std::string &filename)
+void XMLGenerator::saveToFile(const std::string &path)
{
- int ret = xmlSaveFormatFile(filename.c_str(), doc, 1);
+ //check validation of file : It should be nothing
+ FILE *file = fopen(path.c_str(), "wx");
+ if (nullptr == file) {
+ ERR("Abnormal Situation!! File(%s) exist", path.c_str());
+ throw ModesEx(ModesEx::SYSTEM_ERROR);
+ }
+
+ int ret = xmlDocFormatDump(file, doc, 1);
+ fclose(file);
if (-1 == ret) {
- ERR("xmlSaveFormatFile(%s) Fail()", filename.c_str());
+ ERR("xmlSaveFormatFile(%s) Fail(%d)", path.c_str(), errno);
throw ModesEx(ModesEx::INVALID_ARG);
}
-
- return;
}
const std::string XMLGenerator::getModeTypeStr(Mode::ModeType t)
throw ModesEx(ModesEx::INVALID_ARG);
}
- if (0 != remove(path.c_str()) && ENOENT != errno) {
- ERR("remove(%s) Fail(%d)", path.c_str(), errno);
- throw ModesEx(ModesEx::SYSTEM_ERROR);
- }
-
createRootNode();
const std::string modeType = getModeTypeStr(mode.getModeType());