summaryrefslogtreecommitdiffstats
path: root/src/misc/extra/extraUtilFile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/extra/extraUtilFile.c')
-rw-r--r--src/misc/extra/extraUtilFile.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c
index ee9168f6..6b4453a5 100644
--- a/src/misc/extra/extraUtilFile.c
+++ b/src/misc/extra/extraUtilFile.c
@@ -247,6 +247,25 @@ char * Extra_FilePathWithoutName( char * FileName )
ABC_FREE( FileName );
return NULL;
}
+char * Extra_FileDesignName( char * pFileName )
+{
+ char * pBeg, * pEnd, * pStore, * pCur;
+ // find the first dot
+ for ( pEnd = pFileName; *pEnd; pEnd++ )
+ if ( *pEnd == '.' )
+ break;
+ // find the first char
+ for ( pBeg = pEnd - 1; pBeg >= pFileName; pBeg-- )
+ if ( !((*pBeg >= 'a' && *pBeg <= 'z') || (*pBeg >= 'A' && *pBeg <= 'Z') || (*pBeg >= '0' && *pBeg <= '9') || *pBeg == '_') )
+ break;
+ pBeg++;
+ // fill up storage
+ pStore = ABC_ALLOC( char, pEnd - pBeg + 1 );
+ for ( pCur = pStore; pBeg < pEnd; pBeg++, pCur++ )
+ *pCur = *pBeg;
+ *pCur = 0;
+ return pStore;
+}
/**Function*************************************************************