Moved the functions getting full paths for files and directories to
obidms.c/.h files
This commit is contained in:
18
src/obidms.c
18
src/obidms.c
@ -590,7 +590,7 @@ int obi_dms_unlist_indexer(OBIDMS_p dms, Obi_indexer_p indexer)
|
||||
}
|
||||
|
||||
|
||||
char* get_full_path(OBIDMS_p dms, const char* path_name)
|
||||
char* obi_dms_get_dms_path(OBIDMS_p dms)
|
||||
{
|
||||
char* full_path;
|
||||
|
||||
@ -602,8 +602,8 @@ char* get_full_path(OBIDMS_p dms, const char* path_name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (getcwd(full_path, MAX_PATH_LEN) == NULL)
|
||||
{
|
||||
if (getcwd(full_path, MAX_PATH_LEN) == NULL) // TODO not sure at all about this because the DMS must be in the working directory.
|
||||
{ // Maybe better to store when opening, but opening function seems to assume that too.
|
||||
obi_set_errno(OBI_UTILS_ERROR);
|
||||
obidebug(1, "\nError getting the path to a file or directory");
|
||||
return NULL;
|
||||
@ -611,6 +611,16 @@ char* get_full_path(OBIDMS_p dms, const char* path_name)
|
||||
|
||||
strcat(full_path, "/");
|
||||
strcat(full_path, dms->directory_name);
|
||||
|
||||
return full_path;
|
||||
}
|
||||
|
||||
|
||||
char* obi_dms_get_full_path(OBIDMS_p dms, const char* path_name)
|
||||
{
|
||||
char* full_path;
|
||||
|
||||
full_path = obi_dms_get_dms_path(dms);
|
||||
strcat(full_path, "/");
|
||||
strcat(full_path, path_name);
|
||||
|
||||
@ -623,7 +633,7 @@ DIR* opendir_in_dms(OBIDMS_p dms, const char* path_name)
|
||||
char* full_path;
|
||||
DIR* directory;
|
||||
|
||||
full_path = get_full_path(dms, path_name);
|
||||
full_path = obi_dms_get_full_path(dms, path_name);
|
||||
if (full_path == NULL)
|
||||
return NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user