summaryrefslogtreecommitdiff
path: root/app/bin/paths.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-08-08 11:53:12 +0200
commite50482f994b6ebcce864a412111d376e99205cdb (patch)
treeff3192c6aaf213c4922521bed988e4ed4147f537 /app/bin/paths.c
parentd3897ce090dbeb220ed2c782f095597e417cf3cc (diff)
parentb623f5953691b2a0614e6f1f4def86bdbb9a4113 (diff)
Update upstream source from tag 'upstream/5.2.0Beta2.1'
Update to upstream version '5.2.0Beta2.1' with Debian dir 1576f25f4c1496abfed44af31ead67d32c7be650
Diffstat (limited to 'app/bin/paths.c')
-rw-r--r--app/bin/paths.c39
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.