Use $INSTDIR\tmp as the temporary directory for EXE to avoid Windows Defender errors#1247
Merged
Merged
Conversation
marcoesters
marked this pull request as ready for review
May 27, 2026 14:09
lrandersson
previously approved these changes
May 27, 2026
lrandersson
left a comment
Contributor
There was a problem hiding this comment.
I think this looks good. I had some "concerns" initially about user-supplied scripts and use of %TMP% but I think that won't be an issue.
| # being extracted into LOCALAPPDATA | ||
| # See https://github.com/conda/constructor/issues/1243 | ||
| StrCpy $TmpDir "$INSTDIR\tmp" | ||
| System::Call 'kernel32::SetEnvironmentVariable(t,t)i("TMP", "$TmpDir")' |
Contributor
There was a problem hiding this comment.
Just for consistency here we write $TmpDir but further down we write ${TmpDir}.
marcoesters
commented
May 27, 2026
lrandersson
approved these changes
May 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Use
$INSTDIR\tmpas the temporary directory to avoid Windows Defender errors.When
conda-standaloneis called, it extracts itself into a temporary directory. On Windows, this is done using theGetTempPathWfunction, which looks for the%TMP%environment variable first, which defaults to%LOCALAPPDATA%\Temp.Windows Defender may disallow using the user temporary directory for the expanded binary (see #1243), but does allow them to be extracted into different directories. A natural location for such as "local" temporary directory is the installation directory as is already done in the SH installer: https://github.com/conda/constructor/blob/7cbad1abd101078059cd54db28a24fa5ba9520c5/constructor/header.sh
Closes #1243
Checklist - did you ...
newsdirectory (using the template) for the next release's release notes?