project_files/hwc/rtl/sysutils.c
changeset 10564 0cb20aa8877a
parent 10137 a4537aab4117
child 14913 68e1783762bc
--- a/project_files/hwc/rtl/sysutils.c	Sat Nov 29 03:13:06 2014 +0100
+++ b/project_files/hwc/rtl/sysutils.c	Sat Nov 29 05:15:27 2014 +0100
@@ -131,6 +131,24 @@
     return atoi(s.str);
 }
 
+string255 fpcrtl_extractFileDir(string255 f)
+{
+    const char sep[] = {'\\', '/', ':'};
+    LongInt i,j;
+
+    i = f.len - 1;
+    while(i >= 0){
+        for(j = 0; j < sizeof(sep); j++){
+            if(f.str[i] == sep[j]){
+                goto FPCRTL_EXTRACTFILEDIR_END;
+            }
+        }
+        i--;
+    }
+FPCRTL_EXTRACTFILEDIR_END:
+    return fpcrtl_copy(f, 1, i);
+}
+
 //function ExtractFileName(const FileName: string): string;
 //var
 //  i : longint;