msi: Use an enum to represent folder states.

This commit is contained in:
Hans Leidekker 2011-06-30 12:14:07 +02:00 committed by Alexandre Julliard
parent 8ff57beb0e
commit 2cbeb20d39
3 changed files with 17 additions and 12 deletions

View File

@ -877,8 +877,8 @@ static UINT ITERATE_CreateFolders(MSIRECORD *row, LPVOID param)
TRACE("folder is %s\n", debugstr_w(full_path));
folder = msi_get_loaded_folder( package, dir );
if (folder->State == 0) msi_create_full_path( full_path );
folder->State = 3;
if (folder->State == FOLDER_STATE_UNINITIALIZED) msi_create_full_path( full_path );
folder->State = FOLDER_STATE_CREATED_PERSISTENT;
return ERROR_SUCCESS;
}
@ -946,7 +946,7 @@ static UINT ITERATE_RemoveFolders( MSIRECORD *row, LPVOID param )
RemoveDirectoryW( full_path );
folder = msi_get_loaded_folder( package, dir );
folder->State = 0;
folder->State = FOLDER_STATE_REMOVED;
return ERROR_SUCCESS;
}

View File

@ -239,10 +239,10 @@ static UINT msi_create_directory( MSIPACKAGE *package, const WCHAR *dir )
if (!install_path) return ERROR_FUNCTION_FAILED;
folder = msi_get_loaded_folder( package, dir );
if (folder->State == 0)
if (folder->State == FOLDER_STATE_UNINITIALIZED)
{
msi_create_full_path( install_path );
folder->State = 2;
folder->State = FOLDER_STATE_CREATED;
}
return ERROR_SUCCESS;
}

View File

@ -490,6 +490,15 @@ typedef struct tagFeatureList
MSIFEATURE *feature;
} FeatureList;
enum folder_state
{
FOLDER_STATE_UNINITIALIZED,
FOLDER_STATE_EXISTS,
FOLDER_STATE_CREATED,
FOLDER_STATE_CREATED_PERSISTENT,
FOLDER_STATE_REMOVED
};
typedef struct tagMSIFOLDER
{
struct list entry;
@ -502,13 +511,9 @@ typedef struct tagMSIFOLDER
LPWSTR ResolvedTarget;
LPWSTR ResolvedSource;
INT State;
/* 0 = uninitialized */
/* 1 = existing */
/* 2 = created remove if empty */
/* 3 = created persist if empty */
INT Cost;
INT Space;
enum folder_state State;
INT Cost;
INT Space;
} MSIFOLDER;
typedef struct tagFolderList