Relative paths when creating or opening a DMS now work

This commit is contained in:
Celine Mercier
2016-04-29 17:46:36 +02:00
parent 31cf27d676
commit a32920e401
2 changed files with 73 additions and 35 deletions

View File

@ -78,9 +78,14 @@ typedef struct Opened_indexers_list {
* and opening of an OBITools Data Management System (DMS)
*/
typedef struct OBIDMS {
char dms_name[OBIDMS_MAX_NAME+1]; /** The name of the DMS.
*/
char directory_name[OBIDMS_MAX_NAME+1]; /**< The name of the directory
* containing the DMS.
*/
char directory_path[MAX_PATH_LEN]; /**< The absolute path of the directory
* containing the DMS.
*/
DIR* directory; /**< A directory entry usable to
* refer and scan the database directory.
*/
@ -105,7 +110,7 @@ typedef struct OBIDMS {
/**
* @brief Checks if an OBIDMS exists.
*
* @param dms_name A pointer to a C string containing the name of the database.
* @param dms_path A pointer to a C string containing the path to the database.
*
* @returns An integer value indicating the status of the database.
* @retval 1 if the database exists.
@ -115,7 +120,7 @@ typedef struct OBIDMS {
* @since May 2015
* @author Eric Coissac (eric.coissac@metabarcoding.org)
*/
int obi_dms_exists(const char* dms_name);
int obi_dms_exists(const char* dms_path);
/**
@ -127,7 +132,7 @@ int obi_dms_exists(const char* dms_name);
*
* A directory to store Obiblob indexers is also created.
*
* @param dms_name A pointer to a C string containing the name of the database.
* @param dms_path A pointer to a C string containing the path to the database.
* The actual directory name used to store the DMS will be
* `<dms_name>.obidms`.
*
@ -144,7 +149,7 @@ OBIDMS_p obi_create_dms(const char* dms_name);
/**
* @brief Opens an existing OBITools Data Management instance (OBIDMS).
*
* @param dms_name A pointer to a C string containing the name of the database.
* @param dms_path A pointer to a C string containing the path to the database.
*
* @returns A pointer to an OBIDMS structure describing the opened DMS.
* @retval NULL if an error occurred.
@ -153,7 +158,7 @@ OBIDMS_p obi_create_dms(const char* dms_name);
* @since May 2015
* @author Eric Coissac (eric.coissac@metabarcoding.org)
*/
OBIDMS_p obi_open_dms(const char* dms_name);
OBIDMS_p obi_open_dms(const char* dms_path);
/**
@ -162,7 +167,7 @@ OBIDMS_p obi_open_dms(const char* dms_name);
* If the database already exists, this function opens it, otherwise it
* creates a new database.
*
* @param dms_name A pointer to a C string containing the name of the database.
* @param dms_path A pointer to a C string containing the path to the database.
*
* @returns A pointer to an OBIDMS structure describing the OBIDMS.
* @retval NULL if an error occurred.
@ -171,7 +176,7 @@ OBIDMS_p obi_open_dms(const char* dms_name);
* @since May 2015
* @author Eric Coissac (eric.coissac@metabarcoding.org)
*/
OBIDMS_p obi_dms(const char* dms_name);
OBIDMS_p obi_dms(const char* dms_path);
/**
@ -295,9 +300,19 @@ int obi_dms_unlist_indexer(OBIDMS_p dms, Obi_indexer_p indexer);
/**
* Function meant to disappear soon
* @brief Gets the full path to the DMS.
*
* @warning The returned pointer has to be freed by the caller.
*
* @param dms The DMS.
*
* @returns A pointer to the full path.
* @retval NULL if an error occurred.
*
* @since April 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char* obi_dms_get_path(OBIDMS_p dms);
char* obi_dms_get_dms_path(OBIDMS_p dms);
/**