On 9/21/06, Andrey Turkin <[EMAIL PROTECTED]> wrote:
MsiSetTargetPath can be used to change target path for directory after
CostFinalize, and all affected file paths must be recalculated. James
Hawkins sent a patch to make Wine's MSI engine do it for most cases;
this patch fixes one remaining "corner" case with TARGETDIR, and adds
test for it.
ChangeLog:
msi: Don't treat TargetDir specifically in resolve_folder
diff -aur wine-0.9.21/dlls/msi/helpers.c wine-0.9.21-my/dlls/msi/helpers.c
--- wine-0.9.21/dlls/msi/helpers.c 2006-09-13 23:10:25.000000000 +0400
+++ wine-0.9.21-my/dlls/msi/helpers.c 2006-09-22 04:26:42.000000000 +0400
@@ -216,29 +216,13 @@
if (!name)
return NULL;
- /* special resolving for Target and Source root dir */
- if (strcmpW(name,cszTargetDir)==0 || strcmpW(name,cszSourceDir)==0)
+ /* special resolving for Source root dir */
+ if ( strcmpW(name,cszSourceDir)==0)
{
- if (!source)
- {
- LPWSTR check_path;
- check_path = msi_dup_property( package, cszTargetDir );
- if (!check_path)
- {
- check_path = msi_dup_property( package, cszRootDrive );
- if (set_prop)
- MSI_SetPropertyW(package,cszTargetDir,check_path);
- }
-
- /* correct misbuilt target dir */
- path = build_directory_name(2, check_path, NULL);
- clean_spaces_from_path( path );
- if (strcmpiW(path,check_path)!=0)
- MSI_SetPropertyW(package,cszTargetDir,path);
- msi_free(check_path);
- }
- else
+ if (source)
path = get_source_root( package );
+ else
+ path = NULL;
if (folder)
*folder = get_loaded_folder( package, name );
return path;
@@ -251,6 +235,11 @@
if (folder)
*folder = f;
+ if (strcmpW(name, cszTargetDir)==0 && !f->ResolvedTarget && !f->Property)
+ {
+ f->Property = msi_dup_property( package, cszRootDrive );
+ }
+
if (!source && f->ResolvedTarget)
{
path = strdupW( f->ResolvedTarget );
This fix is incorrect. What happens now when we call
resolve_folder(package, "TARGETDIR", FALSE, TRUE, folder)? Your
changelog says "Don't treat TargetDir specifically in resolve_folder"
yet you're treating it specifically right here, but without the
functionality that's still needed. Please resend the tests with
todo_wine around failing tests.
+#define ADD_SLASH(x) do { char *t; if (x[0]) {t=x+strlen(x)-1;if(t[0] != '\\'
) {t[1] ='\\';t[2] ='\0';}}} while (0)
+
This is a really bad macro. Please use PathAddBackslash.
--
James Hawkins