summaryrefslogtreecommitdiffhomepage
path: root/src/core.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2018-01-02 02:26:05 +0100
committerraysan5 <[email protected]>2018-01-02 02:26:05 +0100
commit1a82e1ab26d3db6f9c9c2f633df1e2980524ebfa (patch)
treeba7f07d9be2e535479a133426355707595ad339a /src/core.c
parente1baae02498aab2f4dd84c44732717bb963d18d1 (diff)
downloadraylib-1a82e1ab26d3db6f9c9c2f633df1e2980524ebfa.tar.gz
raylib-1a82e1ab26d3db6f9c9c2f633df1e2980524ebfa.zip
Added function GetFileName()
Review comments
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/core.c b/src/core.c
index 60bc58b8..371a22ee 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1174,7 +1174,7 @@ bool IsFileExtension(const char *fileName, const char *ext)
return result;
}
-// Get the extension for a filename
+// Get pointer to extension for a filename string
const char *GetExtension(const char *fileName)
{
const char *dot = strrchr(fileName, '.');
@@ -1184,6 +1184,17 @@ const char *GetExtension(const char *fileName)
return (dot + 1);
}
+// Get pointer to filename for a path string
+const char *GetFileName(const char *filePath)
+{
+ const char *fileName = strrchr(filePath, '\\');
+
+ if (!fileName || fileName == filePath) return filePath;
+
+ return fileName + 1;
+}
+
+
// Get directory for a given fileName (with path)
const char *GetDirectoryPath(const char *fileName)
{