Additional fixes.

svn path=/trunk/; revision=1661
This commit is contained in:
Carl Nettelblad 2001-03-06 06:20:36 +00:00
parent 2ec9eaf736
commit de10767975
4 changed files with 27 additions and 13 deletions

View file

@ -4,7 +4,7 @@
void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
{
int dir_len;
if ( drive != NULL ) {
if ( drive != NULL && (*drive)) {
strcpy(path,drive);
strcat(path,":");
}
@ -27,6 +27,4 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
strcat(path,ext);
}
}
}

View file

@ -30,13 +30,18 @@ void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ex
strcpy(ext,tmp_ext);
}
else
{
*ext = 0;
tmp_ext = path+strlen(path);
}
if ( tmp_dir != NULL ) {
strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0;
}
else
{
strncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
}

View file

@ -4,20 +4,20 @@
void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
{
int dir_len;
if ( drive != NULL ) {
if ( drive != NULL && (*drive)) {
strcpy(path,drive);
strcat(path,":");
}
else
(*path)=0;
else
(*path)=0;
if ( dir != NULL ) {
strcat(path,dir);
if ( *dir != '\\' )
strcat(path,"\\");
dir_len = strlen(dir);
if (dir_len && *(dir + dir_len - 1) != '\\' )
strcat(path,"\\");
if ( dir_len && *(dir + dir_len - 1) != '\\' )
strcat(path,"\\");
}
if ( fname != NULL ) {
strcat(path,fname);
@ -32,7 +32,7 @@ void _makepath( char *path, const char *drive, const char *dir, const char *fnam
void _wmakepath( wchar_t *path, const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext )
{
int dir_len;
if ( drive != NULL ) {
if ( drive != NULL && (*drive)) {
wcscpy(path,drive);
wcscat(path,L":");
}

View file

@ -30,14 +30,19 @@ void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ex
strcpy(ext,tmp_ext);
}
else
*ext = 0;
if ( tmp_dir != NULL ) {
{
*ext = 0;
tmp_ext = path+strlen(path);
}
if ( tmp_dir != NULL ) {
strncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0;
}
else
{
strncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
}
void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fname, wchar_t *ext )
@ -69,12 +74,18 @@ void _wsplitpath( const wchar_t *path, wchar_t *drive, wchar_t *dir, wchar_t *fn
wcscpy(ext,tmp_ext);
}
else
{
*ext = 0;
tmp_ext = path+wcslen(path);
}
if ( tmp_dir != NULL ) {
wcsncpy(fname,tmp_dir+1,tmp_ext - tmp_dir - 1);
*(fname + (tmp_ext - tmp_dir -1)) = 0;
}
else
{
wcsncpy(fname,path,tmp_ext - path);
*(fname+(tmp_ext-path))=0;
}
}