Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect MAGICK_HOME on Windows #663

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

roelandschoukens
Copy link
Contributor

This avoids clobbering the path given by MAGICK_HOME on Windows if the ImageMagick installer wrote the path to ImageMagick to the registry.

@emcconville
Copy link
Owner

emcconville commented Sep 25, 2024

Can you define "clobbering"? This patch removes coderPath and filterPath. Those paths are needed by folks working with custom modules / configurations.

@emcconville
Copy link
Owner

Ah! I've answered my own question. So folks on windows that have MAGICK_HOME defined will also get unnecessary paths injected. As far as the coder & filter paths, we should kill the following lines...

                coderPath = winreg.QueryValueEx(reg_key, "CoderModulesPath")
                filterPath = winreg.QueryValueEx(reg_key, "FilterModulesPath")

... assuming we don't need those paths exported for folks not defined MAGICK_HOME.

 - Don't read Windows registry if MAGICK_HOME was set, keep the original value
   of the environment variable.
 - It now seems to be enough to only add the path to the main DLL to PATH.
   This is also what the ImageMagick installer does if you ask it to add
   ImageMagick to PATH.
@coveralls
Copy link

Coverage Status

coverage: 87.777%. remained the same
when pulling 1965b74 on roelandschoukens:rs-winpath
into 02c351d on emcconville:master.

@roelandschoukens
Copy link
Contributor Author

OK the problem was it was ignoring MAGICK_HOME, since it was overwriting the variable with a value from the registry. Therefore the patch will make it so it only reads from the registry if that environment variable wasn't set.

There’s three basic possibilities on Windows, either we get the library from the path given by MAGICK_HOME, or we get it from the path in the registry, or we find the DLL on the system PATH. I think these three possibilities now work. (I contributed this read from the registry some years ago, so I have to admit I am also the guy who broke that first case back then).

I remember adding the other two paths was necessary in the past, but that seems not to be the case anymore — the ImageMagick DLL loads successfully without these extra directories on PATH.

btw should I also make an issue for this?

@emcconville emcconville merged commit 48f00a5 into emcconville:master Sep 26, 2024
8 checks passed
@emcconville emcconville added this to the Wand 0.7.0 milestone Sep 26, 2024
@roelandschoukens roelandschoukens deleted the rs-winpath branch October 24, 2024 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants