Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
527d3555
Commit
527d3555
authored
Apr 15, 2016
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the functions getting full paths for files and directories to
obidms.c/.h files
parent
71492ad2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
27 deletions
+23
-27
src/obiavl.c
src/obiavl.c
+2
-19
src/obidms.c
src/obidms.c
+14
-4
src/obidms.h
src/obidms.h
+4
-1
src/obidms_taxonomy.c
src/obidms_taxonomy.c
+1
-1
src/obidmscolumndir.c
src/obidmscolumndir.c
+1
-1
src/obiview.c
src/obiview.c
+1
-1
No files found.
src/obiavl.c
View file @
527d3555
...
...
@@ -510,7 +510,7 @@ char* get_full_path_of_avl_dir(OBIDMS_p dms, const char* avl_name)
{
char
*
avl_dir_name
;
avl_dir_name
=
get_full_path
(
dms
,
INDEXER_DIR_NAME
);
avl_dir_name
=
obi_dms_
get_full_path
(
dms
,
INDEXER_DIR_NAME
);
if
(
avl_dir_name
==
NULL
)
{
obidebug
(
1
,
"
\n
Error getting path for the DMS AVL directory"
);
...
...
@@ -1286,33 +1286,16 @@ int obi_avl_exists(OBIDMS_p dms, const char* avl_name)
{
struct
stat
buffer
;
char
*
avl_dir_path
;
char
*
avl_dir_relative_path
;
int
relative_path_size
;
int
check_dir
;
// Build the AVL tree file path
relative_path_size
=
strlen
(
avl_name
)
+
strlen
(
INDEXER_DIR_NAME
)
+
2
;
avl_dir_relative_path
=
(
char
*
)
malloc
(
relative_path_size
*
sizeof
(
char
));
if
(
avl_dir_relative_path
==
NULL
)
{
obi_set_errno
(
OBI_MALLOC_ERROR
);
obidebug
(
1
,
"
\n
Error allocating memory for the path to the AVL directory"
);
return
-
1
;
}
strcpy
(
avl_dir_relative_path
,
INDEXER_DIR_NAME
);
strcat
(
avl_dir_relative_path
,
"/"
);
strcat
(
avl_dir_relative_path
,
avl_name
);
avl_dir_path
=
get_full_path
(
dms
,
avl_dir_relative_path
);
avl_dir_path
=
get_full_path_of_avl_dir
(
dms
,
avl_name
);
if
(
avl_dir_path
==
NULL
)
{
obidebug
(
1
,
"
\n
Error getting the directory path for an AVL tree"
);
return
-
1
;
}
check_dir
=
stat
(
avl_dir_path
,
&
buffer
);
free
(
avl_dir_path
);
free
(
avl_dir_relative_path
);
if
(
check_dir
==
0
)
return
1
;
...
...
src/obidms.c
View file @
527d3555
...
...
@@ -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
,
"
\n
Error 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
;
...
...
src/obidms.h
View file @
527d3555
...
...
@@ -208,6 +208,9 @@ void obi_dms_list_indexer(OBIDMS_p dms, Obi_indexer_p indexer);
int
obi_dms_unlist_indexer
(
OBIDMS_p
dms
,
Obi_indexer_p
indexer
);
char
*
obi_dms_get_path
(
OBIDMS_p
dms
);
/** TODO
* @brief Internal function getting the full path of a file or a directory from its
* path relative to a directory file descriptor.
...
...
@@ -224,7 +227,7 @@ int obi_dms_unlist_indexer(OBIDMS_p dms, Obi_indexer_p indexer);
* @since June 2015
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char
*
get_full_path
(
OBIDMS_p
dms
,
const
char
*
path_name
);
char
*
obi_dms_
get_full_path
(
OBIDMS_p
dms
,
const
char
*
path_name
);
/**
...
...
src/obidms_taxonomy.c
View file @
527d3555
...
...
@@ -379,7 +379,7 @@ OBIDMS_taxonomy_p obi_read_taxonomy(OBIDMS_p dms, const char* taxonomy_name, boo
buffer_size
=
2048
;
// TODO
main_taxonomy_dir_path
=
get_full_path
(
dms
,
TAXONOMY_DIR_NAME
);
main_taxonomy_dir_path
=
obi_dms_
get_full_path
(
dms
,
TAXONOMY_DIR_NAME
);
taxonomy_path
=
(
char
*
)
malloc
((
strlen
(
main_taxonomy_dir_path
)
+
strlen
(
taxonomy_name
)
+
strlen
(
taxonomy_name
)
+
3
)
*
sizeof
(
char
));
if
(
sprintf
(
taxonomy_path
,
"%s/%s/%s"
,
main_taxonomy_dir_path
,
taxonomy_name
,
taxonomy_name
)
<
0
)
{
...
...
src/obidmscolumndir.c
View file @
527d3555
...
...
@@ -105,7 +105,7 @@ int obi_column_directory_exists(OBIDMS_p dms, const char* column_name)
return
-
1
;
// Get the full path for the column directory
full_path
=
get_full_path
(
dms
,
column_directory_name
);
full_path
=
obi_dms_
get_full_path
(
dms
,
column_directory_name
);
if
(
full_path
==
NULL
)
{
obi_set_errno
(
OBICOLDIR_UNKNOWN_ERROR
);
...
...
src/obiview.c
View file @
527d3555
...
...
@@ -1051,7 +1051,7 @@ int obi_save_view(Obiview_p view)
return
-
1
;
// Get the full path for the column directory
full_path
=
get_full_path
(
view
->
dms
,
view_file_name
);
full_path
=
obi_dms_
get_full_path
(
view
->
dms
,
view_file_name
);
if
(
full_path
==
NULL
)
{
obi_set_errno
(
OBIVIEW_ERROR
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment