msi: Reduce destination file name used in the MoveFiles action to the long file name.

Add a test for this behaviour.
This commit is contained in:
Rob Shearman 2008-09-10 11:01:15 +01:00 committed by Alexandre Julliard
parent e738f6144e
commit ef1b0cacfa
2 changed files with 20 additions and 6 deletions

View File

@ -5564,7 +5564,8 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
{
MSIPACKAGE *package = param;
MSICOMPONENT *comp;
LPCWSTR sourcename, destname;
LPCWSTR sourcename;
LPWSTR destname = NULL;
LPWSTR sourcedir = NULL, destdir = NULL;
LPWSTR source = NULL, dest = NULL;
int options;
@ -5582,7 +5583,6 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
}
sourcename = MSI_RecordGetString(rec, 3);
destname = MSI_RecordGetString(rec, 4);
options = MSI_RecordGetInteger(rec, 7);
sourcedir = msi_dup_property(package, MSI_RecordGetString(rec, 5));
@ -5617,11 +5617,20 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
wildcards = strchrW(source, '*') || strchrW(source, '?');
if (!destname && !wildcards)
if (MSI_RecordIsNull(rec, 4))
{
destname = strdupW(sourcename);
if (!destname)
goto done;
if (!wildcards)
{
destname = strdupW(sourcename);
if (!destname)
goto done;
}
}
else
{
destname = strdupW(MSI_RecordGetString(rec, 4));
if (destname)
reduce_to_longfilename(destname);
}
size = 0;
@ -5658,6 +5667,7 @@ static UINT ITERATE_MoveFiles( MSIRECORD *rec, LPVOID param )
done:
msi_free(sourcedir);
msi_free(destdir);
msi_free(destname);
msi_free(source);
msi_free(dest);

View File

@ -575,6 +575,7 @@ static const CHAR mov_move_file_dat[] = "FileKey\tComponent_\tSourceName\tDestNa
"kazakhstan\taugustus\t\tkiribati\tFILEPATHGOOD\tMSITESTDIR\t1\n"
"laos\taugustus\tlatvia\tlebanon\tSourceDir\tMSITESTDIR\t1\n"
"namibia\taugustus\tnauru\tkiribati\tSourceDir\tMSITESTDIR\t1\n"
"pakistan\taugustus\tperu\tsfn|poland\tSourceDir\tMSITESTDIR\t1\n"
"wildcard\taugustus\tapp*\twildcard\tSourceDir\tMSITESTDIR\t1\n"
"single\taugustus\tf?o\tsingle\tSourceDir\tMSITESTDIR\t1\n"
"wildcardnodest\taugustus\tbudd*\t\tSourceDir\tMSITESTDIR\t1\n"
@ -4390,6 +4391,7 @@ static void test_movefiles(void)
create_file("kenya", 100);
CreateDirectoryA("latvia", NULL);
create_file("nauru", 100);
create_file("peru", 100);
create_file("apple", 100);
create_file("application", 100);
create_file("ape", 100);
@ -4430,6 +4432,7 @@ static void test_movefiles(void)
ok(delete_pf("msitest\\kiribati", TRUE), "File not moved\n");
ok(!delete_pf("msitest\\lebanon", TRUE), "File moved\n");
ok(!delete_pf("msitest\\lebanon", FALSE), "Directory moved\n");
ok(delete_pf("msitest\\poland", TRUE), "File not moved\n");
/* either apple or application will be moved depending on directory order */
if (!delete_pf("msitest\\apple", TRUE))
ok(delete_pf("msitest\\application", TRUE), "File not moved\n");
@ -4462,6 +4465,7 @@ static void test_movefiles(void)
ok(!DeleteFileA("kenya"), "File not moved\n");
ok(RemoveDirectoryA("latvia"), "Directory moved\n");
ok(!DeleteFileA("nauru"), "File not moved\n");
ok(!DeleteFileA("peru"), "File not moved\n");
ok(!DeleteFileA("apple"), "File not moved\n");
ok(!DeleteFileA("application"), "File not moved\n");
ok(DeleteFileA("ape"), "File moved\n");