msi: Only specifically resolve the TARGETDIR directory once.

This commit is contained in:
James Hawkins 2006-09-25 20:04:55 -07:00 committed by Alexandre Julliard
parent 3ee3fc35ef
commit ad609f1518
2 changed files with 14 additions and 23 deletions

View File

@ -216,10 +216,14 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
if (!name)
return NULL;
f = get_loaded_folder( package, name );
if (!f)
return NULL;
/* special resolving for Target and Source root dir */
if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
{
if (!source)
if (!f->ResolvedTarget && !f->Property)
{
LPWSTR check_path;
check_path = msi_dup_property( package, cszTargetDir );
@ -236,17 +240,13 @@ LPWSTR resolve_folder(MSIPACKAGE *package, LPCWSTR name, BOOL source,
if (strcmpiW(path,check_path)!=0)
MSI_SetPropertyW(package,cszTargetDir,path);
msi_free(check_path);
}
else
path = get_source_root( package );
if (folder)
*folder = get_loaded_folder( package, name );
return path;
}
f = get_loaded_folder( package, name );
if (!f)
return NULL;
f->ResolvedTarget = path;
}
if (!f->ResolvedSource)
f->ResolvedSource = get_source_root( package );
}
if (folder)
*folder = f;

View File

@ -454,10 +454,7 @@ static void test_getsourcepath( void )
sz = sizeof buffer -1;
strcpy(buffer,"x bad");
r = MsiGetSourcePath( hpkg, "TARGETDIR", buffer, &sz );
todo_wine
{
ok( r == ERROR_DIRECTORY, "return value wrong\n");
}
ok( r == ERROR_DIRECTORY, "return value wrong\n");
r = MsiDoAction( hpkg, "CostInitialize");
ok( r == ERROR_SUCCESS, "cost init failed\n");
@ -675,17 +672,11 @@ static void test_settargetpath(void)
lstrcat( tempdir, "\\" );
r = MsiGetTargetPath( hpkg, "TARGETDIR", buffer, &sz );
ok( r == ERROR_SUCCESS, "failed to get target path: %d\n", r);
todo_wine
{
ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
}
ok( !lstrcmp(buffer, tempdir), "Expected %s, got %s\n", tempdir, buffer);
sprintf( file, "%srootfile.txt", tempdir );
query_file_path( hpkg, "[#RootFile]", buffer );
todo_wine
{
ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
}
ok( !lstrcmp(buffer, file), "Expected %s, got %s\n", file, buffer);
r = MsiSetTargetPath( hpkg, "TestParent", "C:\\one\\two" );
ok( r == ERROR_SUCCESS, "MsiSetTargetPath returned %d\n", r );