From c1190fe2b46ebe8c95c74f79dc2d2b1c0d240a5c Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Sun, 11 Oct 1998 13:57:09 +0000 Subject: [PATCH] GetLongPathName32A() returns dos format long filename instead of unix format. --- files/dos_fs.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/files/dos_fs.c b/files/dos_fs.c index 14814297803..67b7e204f6e 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -886,11 +886,27 @@ DWORD WINAPI GetLongPathName32A( LPCSTR shortpath, LPSTR longpath, DWORD longlen ) { DOS_FULL_NAME full_name; - - /* FIXME: Is it correct to return a UNIX style path here? */ + char *p; + char *longfilename; + DWORD shortpathlen; + if (!DOSFS_GetFullName( shortpath, TRUE, &full_name )) return 0; - lstrcpyn32A( longpath, full_name.long_name, longlen ); - return strlen( full_name.long_name ); + lstrcpyn32A( longpath, full_name.short_name, longlen ); + /* Do some hackery to get the long filename. + * FIXME: Would be better if it returned the + * long version of the directories too + */ + longfilename = strrchr(full_name.long_name, '/')+1; + if (longpath != NULL) { + if ((p = strrchr( longpath, '\\' )) != NULL) { + p++; + longlen -= (p-longpath); + lstrcpyn32A( p, longfilename , longlen); + } + } + shortpathlen = + ((strrchr( full_name.short_name, '\\' ) - full_name.short_name) + 1); + return shortpathlen + strlen( longfilename ); }