diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-05 16:16:47 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-11-05 16:16:47 -0800 |
commit | e4ff9cc9a5d519c2daf4e3ced0a706189602b9a8 (patch) | |
tree | 4122fedf18afefe8421584b5cee7861a13230b99 | |
parent | ad7c8d6382f1a58c2b59b0294aa9e97c3de9487d (diff) | |
download | abc-e4ff9cc9a5d519c2daf4e3ced0a706189602b9a8.tar.gz abc-e4ff9cc9a5d519c2daf4e3ced0a706189602b9a8.tar.bz2 abc-e4ff9cc9a5d519c2daf4e3ced0a706189602b9a8.zip |
Added minor API to clean path on a Windows computer.
-rw-r--r-- | src/misc/extra/extra.h | 1 | ||||
-rw-r--r-- | src/misc/extra/extraUtilFile.c | 25 |
2 files changed, 24 insertions, 2 deletions
diff --git a/src/misc/extra/extra.h b/src/misc/extra/extra.h index 4e36554c..5d9c405f 100644 --- a/src/misc/extra/extra.h +++ b/src/misc/extra/extra.h @@ -103,6 +103,7 @@ extern char * Extra_FileNameExtension( char * FileName ); extern char * Extra_FileNameAppend( char * pBase, char * pSuffix ); extern char * Extra_FileNameGeneric( char * FileName ); extern char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix ); +extern void Extra_FileNameCorrectPath( char * FileName ); extern char * Extra_FileNameWithoutPath( char * FileName ); extern char * Extra_FilePathWithoutName( char * FileName ); extern int Extra_FileCheck( char * pFileName ); diff --git a/src/misc/extra/extraUtilFile.c b/src/misc/extra/extraUtilFile.c index bec8ba1e..ee9168f6 100644 --- a/src/misc/extra/extraUtilFile.c +++ b/src/misc/extra/extraUtilFile.c @@ -205,6 +205,26 @@ char * Extra_FileNameGenericAppend( char * pBase, char * pSuffix ) SeeAlso [] ***********************************************************************/ +void Extra_FileNameCorrectPath( char * FileName ) +{ + char * pStart; + if ( FileName ) + for ( pStart = FileName; *pStart; pStart++ ) + if ( *pStart == '>' || *pStart == '\\' ) + *pStart = '/'; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ char * Extra_FileNameWithoutPath( char * FileName ) { char * pRes; @@ -220,8 +240,9 @@ char * Extra_FilePathWithoutName( char * FileName ) for ( pRes = FileName + strlen(FileName) - 1; pRes >= FileName; pRes-- ) if ( *pRes == '\\' || *pRes == '/' ) { - *pRes = 0; - return FileName; + *pRes = 0; + Extra_FileNameCorrectPath( FileName ); + return FileName; } ABC_FREE( FileName ); return NULL; |