changeset 32644:a6431ff5481f

Add mp_path_is_absolute function.
author cboesch
date Fri, 24 Dec 2010 23:09:08 +0000
parents d68c55785751
children 715c9997201e
files path.c path.h
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/path.c	Fri Dec 24 23:05:49 2010 +0000
+++ b/path.c	Fri Dec 24 23:09:08 2010 +0000
@@ -233,3 +233,15 @@
     dirname[len] = '\0';
     return dirname;
 }
+
+/**
+ * @brief Indicates weither the path is absolute or not.
+ */
+int mp_path_is_absolute(const char *path)
+{
+#if HAVE_DOS_PATHS
+    return path[0] && path[1] == ':';
+#else
+    return path[0] == '/';
+#endif
+}
--- a/path.h	Fri Dec 24 23:05:49 2010 +0000
+++ b/path.h	Fri Dec 24 23:09:08 2010 +0000
@@ -28,5 +28,6 @@
 void set_codec_path(const char *path);
 const char *mp_basename(const char *path);
 char *mp_dirname(const char *path);
+int mp_path_is_absolute(const char *path);
 
 #endif /* MPLAYER_PATH_H */