Create component folders in the CreateFolders action.
This commit is contained in:
parent
78e59c50c3
commit
03b4dbbdc4
|
@ -1052,6 +1052,27 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: probably should merge this with the above function */
|
||||||
|
static UINT msi_create_directory( MSIPACKAGE* package, LPCWSTR dir )
|
||||||
|
{
|
||||||
|
UINT rc = ERROR_SUCCESS;
|
||||||
|
MSIFOLDER *folder;
|
||||||
|
LPWSTR install_path;
|
||||||
|
|
||||||
|
install_path = resolve_folder(package, dir, FALSE, FALSE, &folder);
|
||||||
|
if (!install_path)
|
||||||
|
return ERROR_FUNCTION_FAILED;
|
||||||
|
|
||||||
|
/* create the path */
|
||||||
|
if (folder->State == 0)
|
||||||
|
{
|
||||||
|
create_full_pathW(install_path);
|
||||||
|
folder->State = 2;
|
||||||
|
}
|
||||||
|
msi_free(install_path);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Also we cannot enable/disable components either, so for now I am just going
|
* Also we cannot enable/disable components either, so for now I am just going
|
||||||
|
@ -1066,7 +1087,9 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
|
||||||
'`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 };
|
'`','C','r','e','a','t','e','F','o','l','d','e','r','`',0 };
|
||||||
UINT rc;
|
UINT rc;
|
||||||
MSIQUERY *view;
|
MSIQUERY *view;
|
||||||
|
MSICOMPONENT *comp;
|
||||||
|
|
||||||
|
/* create all the empty folders specified in the CreateFolder table */
|
||||||
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view );
|
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view );
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
|
@ -1074,6 +1097,14 @@ static UINT ACTION_CreateFolders(MSIPACKAGE *package)
|
||||||
rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package);
|
rc = MSI_IterateRecords(view, NULL, ITERATE_CreateFolders, package);
|
||||||
msiobj_release(&view->hdr);
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,26 +56,6 @@ extern const WCHAR szRemoveFiles[];
|
||||||
|
|
||||||
static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
|
static const WCHAR cszTempFolder[]= {'T','e','m','p','F','o','l','d','e','r',0};
|
||||||
|
|
||||||
static UINT create_component_directory( MSIPACKAGE* package, MSICOMPONENT *comp )
|
|
||||||
{
|
|
||||||
UINT rc = ERROR_SUCCESS;
|
|
||||||
MSIFOLDER *folder;
|
|
||||||
LPWSTR install_path;
|
|
||||||
|
|
||||||
install_path = resolve_folder(package, comp->Directory, FALSE, FALSE, &folder);
|
|
||||||
if (!install_path)
|
|
||||||
return ERROR_FUNCTION_FAILED;
|
|
||||||
|
|
||||||
/* create the path */
|
|
||||||
if (folder->State == 0)
|
|
||||||
{
|
|
||||||
create_full_pathW(install_path);
|
|
||||||
folder->State = 2;
|
|
||||||
}
|
|
||||||
msi_free(install_path);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a helper function for handling embedded cabinet media
|
* This is a helper function for handling embedded cabinet media
|
||||||
|
@ -463,7 +443,7 @@ static void free_media_info( struct media_info *mi )
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
|
static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
|
||||||
MSIFILE *file, MSICOMPONENT* comp )
|
MSIFILE *file )
|
||||||
{
|
{
|
||||||
UINT rc = ERROR_SUCCESS;
|
UINT rc = ERROR_SUCCESS;
|
||||||
MSIRECORD * row = 0;
|
MSIRECORD * row = 0;
|
||||||
|
@ -478,6 +458,7 @@ static UINT ready_media_for_file( MSIPACKAGE *package, struct media_info *mi,
|
||||||
INT seq;
|
INT seq;
|
||||||
UINT type;
|
UINT type;
|
||||||
LPCWSTR prompt;
|
LPCWSTR prompt;
|
||||||
|
MSICOMPONENT *comp = file->Component;
|
||||||
|
|
||||||
if (file->Sequence <= mi->last_sequence)
|
if (file->Sequence <= mi->last_sequence)
|
||||||
{
|
{
|
||||||
|
@ -681,8 +662,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
||||||
/* Pass 1 */
|
/* Pass 1 */
|
||||||
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
LIST_FOR_EACH_ENTRY( file, &package->files, MSIFILE, entry )
|
||||||
{
|
{
|
||||||
MSICOMPONENT* comp = NULL;
|
|
||||||
|
|
||||||
if (!ACTION_VerifyComponentForAction(package, file->Component,
|
if (!ACTION_VerifyComponentForAction(package, file->Component,
|
||||||
INSTALLSTATE_LOCAL))
|
INSTALLSTATE_LOCAL))
|
||||||
{
|
{
|
||||||
|
@ -691,31 +670,6 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
||||||
debugstr_w(file->File));
|
debugstr_w(file->File));
|
||||||
|
|
||||||
file->State = 5;
|
file->State = 5;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((file->State == 1) || (file->State == 2))
|
|
||||||
{
|
|
||||||
LPWSTR p = NULL;
|
|
||||||
|
|
||||||
TRACE("Pass 1: %s\n",debugstr_w(file->File));
|
|
||||||
|
|
||||||
create_component_directory( package, file->Component );
|
|
||||||
|
|
||||||
/* recalculate file paths because things may have changed */
|
|
||||||
|
|
||||||
comp = file->Component;
|
|
||||||
if (!comp)
|
|
||||||
{
|
|
||||||
ERR("No Component for file\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
p = resolve_folder(package, comp->Directory, FALSE, FALSE, NULL);
|
|
||||||
msi_free(file->TargetPath);
|
|
||||||
|
|
||||||
file->TargetPath = build_directory_name(2, p, file->FileName);
|
|
||||||
msi_free(p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +682,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package)
|
||||||
{
|
{
|
||||||
TRACE("Pass 2: %s\n",debugstr_w(file->File));
|
TRACE("Pass 2: %s\n",debugstr_w(file->File));
|
||||||
|
|
||||||
rc = ready_media_for_file( package, mi, file, file->Component );
|
rc = ready_media_for_file( package, mi, file );
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ERR("Unable to ready media\n");
|
ERR("Unable to ready media\n");
|
||||||
|
|
Loading…
Reference in New Issue