Some installers don't call the CreateFolders action before the

InstallFiles action as MSDN specifies, but it still seems to work, so
make sure that we create component directories in the InstallFiles
action anyway.
This commit is contained in:
Mike McCormack 2005-10-29 11:29:17 +00:00 committed by Alexandre Julliard
parent c258430643
commit 9c8458514c
3 changed files with 25 additions and 8 deletions

View File

@ -1074,6 +1074,21 @@ static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir )
return rc;
}
UINT msi_create_component_directories( MSIPACKAGE *package )
{
MSICOMPONENT *comp;
/* create all the folders required by the components are going to install */
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
continue;
msi_create_directory( package, comp->Directory );
}
return ERROR_SUCCESS;
}
/*
* Also we cannot enable/disable components either, so for now I am just going
* to do all the directories for all the components.
@ -1087,7 +1102,6 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
'`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 };
UINT rc;
MSIQUERY *view;
MSICOMPONENT *comp;
/* create all the empty folders specified in the CreateFolder table */
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view );
@ -1097,13 +1111,7 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package);
msiobj_release(&view->hdr);
/* create all the folders required by the components are going to install */
LIST_FOR_EACH_ENTRY( comp, &package->components, MSICOMPONENT, entry )
{
if (!ACTION_VerifyComponentForAction(package, comp, INSTALLSTATE_LOCAL))
continue;
msi_create_directory( package, comp->Directory );
}
msi_create_component_directories( package );
return rc;
}

View File

@ -273,6 +273,7 @@ extern void ACTION_UpdateComponentStates(MSIPACKAGE *package, LPCWSTR szFeature)
extern UINT register_unique_action(MSIPACKAGE *, LPCWSTR);
extern BOOL check_unique_action(MSIPACKAGE *, LPCWSTR);
extern WCHAR* generate_error_string(MSIPACKAGE *, UINT, DWORD, ... );
extern UINT msi_create_component_directories( MSIPACKAGE *package );
/* control event stuff */

View File

@ -674,6 +674,14 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
}
}
/*
* Despite MSDN specifying that the CreateFolders action
* should be called before InstallFiles, some installers don't
* do that, and they seem to work correctly. We need to create
* directories here to make sure that the files can be copied.
*/
msi_create_component_directories( package );
mi = create_media_info();
/* Pass 2 */