From b623f5953691b2a0614e6f1f4def86bdbb9a4113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 8 Aug 2020 11:53:00 +0200 Subject: New upstream version 5.2.0Beta2.1 --- app/bin/paths.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'app/bin/paths.c') diff --git a/app/bin/paths.c b/app/bin/paths.c index cbd9b38..6c6bb10 100644 --- a/app/bin/paths.c +++ b/app/bin/paths.c @@ -69,7 +69,7 @@ FindPath(const char *type) } /** - * Add a path to the table. If it already exists, the value ist updated. + * Add a path to the table. If it already exists, the value list updated. * * \param type IN type of path * \param path IN path @@ -161,6 +161,21 @@ char *GetCurrentPath( return ((char *)path); } +/** + * Convert path to forward slash + * + * \param [in,out] string If non-null, the string. + */ + +void ConvertPathForward(char *string) +{ + char *ptr = string; + while ((ptr = strchr(ptr, '\\')) != NULL) { + ptr[0] = '/'; + ptr++; + } +} + /** * Find the filename/extension piece in a fully qualified path * @@ -182,9 +197,29 @@ char *FindFilename(char *path) return (name); } +/** + * Find file extension in a filename + * + * \param path IN full or partial path + * \return pointer to the file extension part, empty string if no extension present + */ + +char *FindFileExtension(char *path) { + char *ext; + ext = strrchr(path, '.'); + + if (ext) { + ext++; + } else { + ext = path + strlen(path); + } + + return ext; +} + /** * Make a full path definition from directorys and filenames. The individual pieces are -* concatinated. Where necessary a path delimiter is added. A pointer to the resulting +* Concatenated. Where necessary a path delimiter is added. A pointer to the resulting * string is returned. This memory should be free'd when no longer needed. * Windows: to construct an absolute path, a leading backslash has to be included after * the drive delimiter ':' or at the beginning of the first directory name. -- cgit v1.2.3