mirror of
https://github.com/deltachat/deltachat-core.git
synced 2025-10-06 03:50:08 +02:00
add function to remove slash from path
This commit is contained in:
parent
9b9cbac1a4
commit
f61b811445
2 changed files with 16 additions and 0 deletions
|
@ -995,6 +995,21 @@ char* dc_extract_grpid_from_rfc724_mid_list(const clist* list)
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* removes trailing slash from given path.
|
||||||
|
*/
|
||||||
|
void dc_ensure_no_slash(char* pathNfilename)
|
||||||
|
{
|
||||||
|
int path_len = strlen(pathNfilename);
|
||||||
|
if (path_len > 0) {
|
||||||
|
if (pathNfilename[path_len-1]=='/'
|
||||||
|
|| pathNfilename[path_len-1]=='\\') {
|
||||||
|
pathNfilename[path_len-1] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int dc_file_exist(const char* pathNfilename)
|
int dc_file_exist(const char* pathNfilename)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
|
@ -95,6 +95,7 @@ char* dc_extract_grpid_from_rfc724_mid_list(const clist* rfc724_mid_list);
|
||||||
|
|
||||||
|
|
||||||
/* file tools */
|
/* file tools */
|
||||||
|
void dc_ensure_no_slash (char* pathNfilename);
|
||||||
int dc_file_exist (const char* pathNfilename);
|
int dc_file_exist (const char* pathNfilename);
|
||||||
uint64_t dc_get_filebytes (const char* pathNfilename);
|
uint64_t dc_get_filebytes (const char* pathNfilename);
|
||||||
char* dc_get_filename (const char* pathNfilename); /* the return value must be free()'d */
|
char* dc_get_filename (const char* pathNfilename); /* the return value must be free()'d */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue