GetFullPathName patch
Duane Clark
dclark at akamail.com
Mon Jul 1 11:53:03 CDT 2002
Here are some additional modifications for handling various Unix style
path names, this time in GetFullPathName. Again, these are a result of
testing with Xilinx software. Xilinx ISE appears to generate just about
every possible combination of DOS and Unix formats :-)
This patch includes the previous patch to GetPathDrive.
This patch modifies the handling of paths which begin with either a
forward or backslash. In this case, Windows simply prepends the current
drive letter. However, this patch handles that slightly differently to
check whether the path corresponds to a mapped drive. If so, the output
path will have the mapped drive designation. At least, that is what the
Xilinx software is expecting. Otherwise if not a mapped drive, we match
the Windows method.
Changelog: In DoGetFullPathName, check absolute paths for mapped drive.
-------------- next part --------------
Index: files/dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.112
diff -u -r1.112 dos_fs.c
--- files/dos_fs.c 21 Jun 2002 19:00:13 -0000 1.112
+++ files/dos_fs.c 1 Jul 2002 16:40:33 -0000
@@ -835,7 +835,7 @@
drive = FILE_toupper(*p) - 'A';
*name += 2;
}
- else if (*p == '/') /* Absolute Unix path? */
+ else if (*p == '/' || *p == '\\') /* Absolute Unix path? */
{
if ((drive = DRIVE_FindDriveRoot( name )) == -1)
{
@@ -1239,7 +1239,7 @@
DWORD ret;
DOS_FULL_NAME full_name;
char *p,*q;
- const char * root;
+ const char * root, * ppath;
char drivecur[]="c:.";
char driveletter=0;
int namelen,drive=0;
@@ -1259,12 +1259,34 @@
lstrcpynA(full_name.short_name,name,MAX_PATHNAME_LEN);
drive = (int)FILE_toupper(name[0]) - 'A';
}
+ else if ((name[0]=='\\') || (name[0]=='/'))
+ {
+ ppath = name;
+ if ((drive = DRIVE_FindDriveRoot( &ppath )) == -1)
+ {
+ /* If the absolute path does not correspond to a configured
+ DOS drive, then just prepend the drive letter of the current
+ drive. This is the normal Windows behavior. */
+ drive = DRIVE_GetCurrentDrive();
+ root= DRIVE_GetRoot(drive);
+ full_name.short_name[0] = root[1] - ('a' - 'A');
+ full_name.short_name[1] = ':';
+ lstrcpynA(full_name.short_name+2,name,MAX_PATHNAME_LEN-3);
+ }
+ else
+ {
+ /* Deviate from normal Windows behavior if the absolute path
+ corresponds to a configured DOS drive. */
+ root= DRIVE_GetRoot(drive);
+ full_name.short_name[0] = root[1] - ('a' - 'A');
+ full_name.short_name[1] = ':';
+ lstrcpynA(full_name.short_name+2,ppath,MAX_PATHNAME_LEN-3);
+ }
+ }
else
{
if (driveletter)
drivecur[0]=driveletter;
- else if ((name[0]=='\\') || (name[0]=='/'))
- strcpy(drivecur,"\\");
else
strcpy(drivecur,".");
@@ -1306,6 +1328,7 @@
full_name.short_name[namelen] = 0;
lstrcpynA(full_name.short_name +namelen,p,MAX_PATHNAME_LEN-namelen);
}
+ TRACE("drive %d shortname %s\n", drive, full_name.short_name);
/* reverse all slashes */
for (p=full_name.short_name;
p < full_name.short_name+strlen(full_name.short_name);
More information about the wine-patches
mailing list