2 Copyright (C) 2012 Modelon AB
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the BSD style license.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 FMILIB_License.txt file for more details.
12 You should have received a copy of the FMILIB_License.txt file
13 along with this program. If not, contact Modelon AB <http://www.modelon.com>.
21 #include <fmilib_config.h>
\r
22 #include <JM/jm_portability.h>
\r
23 #include <FMI/fmi_import_util.h>
\r
25 char* fmi_import_mk_temp_dir(jm_callbacks* cb, const char* systemTempDir, const char* tempPrefix) {
26 if(!tempPrefix) tempPrefix = "fmil";
27 return jm_mk_temp_dir(cb, systemTempDir, tempPrefix);
30 char* fmi_import_create_URL_from_abs_path(jm_callbacks* cb, const char* absPath) {
31 return jm_create_URL_from_abs_path(cb, absPath);
34 jm_status_enu_t fmi_import_rmdir(jm_callbacks* cb, const char* dir) {
\r
35 return jm_rmdir(cb, dir);
\r
38 char* fmi_import_get_dll_path(const char* fmu_unzipped_path, const char* model_identifier, jm_callbacks* callbacks)
\r
43 if (model_identifier == NULL || fmu_unzipped_path == NULL) {
\r
48 len = strlen(fmu_unzipped_path) + strlen(FMI_FILE_SEP) + strlen(FMI_BINARIES) + strlen(FMI_FILE_SEP) + strlen(FMI_PLATFORM) + strlen(FMI_FILE_SEP) + strlen(model_identifier) + strlen(FMI_DLL_EXT) + 1;
\r
50 dll_path = (char*)callbacks->calloc(len, sizeof(char));
\r
51 if (dll_path == NULL) {
\r
52 jm_log_fatal(callbacks, "FMILIB", "Failed to allocate memory.");
\r
56 jm_snprintf(dll_path, len, "%s%s%s%s%s%s%s%s", fmu_unzipped_path, FMI_FILE_SEP, FMI_BINARIES, FMI_FILE_SEP, FMI_PLATFORM, FMI_FILE_SEP, model_identifier, FMI_DLL_EXT);
\r
61 char* fmi_import_get_model_description_path(const char* fmu_unzipped_path, jm_callbacks* callbacks)
\r
63 char* model_description_path;
\r
66 len = strlen(fmu_unzipped_path) + strlen(FMI_FILE_SEP) + strlen(FMI_MODEL_DESCRIPTION_XML) + 1;
\r
68 model_description_path = (char*)callbacks->calloc(len, sizeof(char));
\r
69 if (model_description_path == NULL) {
\r
70 callbacks->logger(NULL, "FMIIMPORTUTIL", jm_log_level_error, "Failed to allocate memory.");
\r
74 jm_snprintf(model_description_path, len, "%s%s%s", fmu_unzipped_path, FMI_FILE_SEP, FMI_MODEL_DESCRIPTION_XML);
\r
76 return model_description_path;
\r