diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-08-08 11:53:00 +0200 |
commit | b623f5953691b2a0614e6f1f4def86bdbb9a4113 (patch) | |
tree | 18102bd36f7e22eb2ba2b9f880e4cb29346f4cb8 /app/bin/paths.c | |
parent | 359b557176b9bb2ff1aed2082641eed39c358d0d (diff) |
New upstream version 5.2.0Beta2.1upstream/5.2.0Beta2.1
Diffstat (limited to 'app/bin/paths.c')
-rw-r--r-- | app/bin/paths.c | 39 |
1 files changed, 37 insertions, 2 deletions
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 @@ -162,6 +162,21 @@ char *GetCurrentPath( } /** + * 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 * * \param path IN the full path @@ -183,8 +198,28 @@ char *FindFilename(char *path) } /** + * 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. |