From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/111299 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thangalin Newsgroups: gmane.comp.tex.context Subject: Update setpath to set the path Date: Sun, 9 May 2021 12:14:49 -0700 Message-ID: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7006889668737324945==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3940"; mail-complaints-to="usenet@ciao.gmane.io" To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sun May 09 21:15:39 2021 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfotv-0000sc-Ju for gctc-ntg-context-518@m.gmane-mx.org; Sun, 09 May 2021 21:15:39 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 48CBD2835C1; Sun, 9 May 2021 21:15:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 40vFe_O9G0-P; Sun, 9 May 2021 21:15:06 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 84C412835BD; Sun, 9 May 2021 21:15:06 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id CC4F22835B6 for ; Sun, 9 May 2021 21:15:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EQPsS3eu8wwE for ; Sun, 9 May 2021 21:15:02 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.161.51; helo=mail-oo1-f51.google.com; envelope-from=thangalin@gmail.com; receiver= Original-Received: from mail-oo1-f51.google.com (mail-oo1-f51.google.com [209.85.161.51]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 5996D2835B1 for ; Sun, 9 May 2021 21:15:02 +0200 (CEST) Original-Received: by mail-oo1-f51.google.com with SMTP id w6-20020a4a9d060000b02901f9175244e7so3035773ooj.9 for ; Sun, 09 May 2021 12:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=plct+NHak1HbXkE6mKMrSoymop1VBXHG6seteF8KhII=; b=KE9K+vQ7iW2XPc71p80AFCFyUY5+eJEJdqL8JGGi/THicdzqA3hMcCN9cjWE1wCweu AfDe9cdAgJk9Mt1ivE/QhyXLQGu27HFyWhL0PCFm8A85KmerZENUfeZFRSn66lY6WpqC /M57x2jVlmrfW5R0uOigptEF9cN1cnFvizPTv5wUbOnv5AyZdguVihBvhInt3G9gEfsH +7/cjAMLPFCzhS3COaaquo7uhU5ptfEAACnuDncBwPJudTIv7St2h5MKIxx5JjjtDpi2 rTk4iXG3QYcEximmA9S6sip19wTrXFEovM/RfM2NBL77o4FJnowq4/0y6y3NqjWFX2Bx fO0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=plct+NHak1HbXkE6mKMrSoymop1VBXHG6seteF8KhII=; b=sAlQKJvU2QVZOTt+v8aXbqpEK1Lepbbg7rnpSay9aCuuTpzMIqXh3G15p/D6N9jYBa HLDu21j9xYtHFnzE6H3EbCZORaSSJ2RcGAAV7qkX+igj1Y4Q4ABwgo9S2epKIXCS3YQl IOsWno1OJZfuHiZ1ofzkNZOy/Y66yvri4qpdJ0rCReUSQ0OaIJVzjuy8YA80O6hJceRW JrMSqGhmH18cG0ZFltPF6zdES0ct+xq2sDNti0IH+xo8SisryY0hIldyMTer9VFHHj0d yDfT3Ce6W3rXg1eU6iKFv1y8u937DSjzjhi5VqyrS+t36vIMfCBXrEZEV8ViImP5mlQE O3eA== X-Gm-Message-State: AOAM533zus16GTNkw9be0BAa8cpQWkij53ufKWm2rzXiS5mW9ftX1tvN mu32PeZ2WZ4uUuRGCE5UidUaa5PFLsT7pcnlBhS+a9KeLOc= X-Google-Smtp-Source: ABdhPJw4dTUUgwgBeCMTbtVm2hqktLszdd7g+vdDKnSIcxnTULswh0g5b9NyzSkUVD0GLsYaC+nl05Lghp1zFOdVhew= X-Received: by 2002:a4a:8dd6:: with SMTP id a22mr16412868ool.74.1620587700286; Sun, 09 May 2021 12:15:00 -0700 (PDT) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:111299 Archived-At: --===============7006889668737324945== Content-Type: multipart/alternative; boundary="00000000000033f98905c1ea7ad7" --00000000000033f98905c1ea7ad7 Content-Type: text/plain; charset="UTF-8" Thoughts on updating the setpath.bat file to persist setting the path? Here's an updated version that sets the system environment variable while preserving the existing unexpanded PATH value: rem SOF echo off set OWNPATH=%~dp0 set PLATFORM=mswin if defined ProgramFiles(x86) set PLATFORM=win64 if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set PLATFORM=win64 if exist "%OWNPATH%tex\texmf-mswin\bin\context.exe" set PLATFORM=mswin if exist "%OWNPATH%tex\texmf-win64\bin\context.exe" set PLATFORM=win64 echo %PATH% | findstr "texmf-%PLATFORM%" > nul rem Only update the PATH if not previously updated if ERRORLEVEL 1 ( set Key="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" set "CurrPath=" for /F "USEBACKQ tokens=2*" %%A in (`reg query %%Key%% /v PATH`) do ( if not "%%~B" == "" ( rem Preserve the existing PATH echo %%B > currpath.txt rem Update the current session set PATH=%PATH%;%OWNPATH%tex\texmf-%PLATFORM%\bin rem Change the PATH environment variable setx PATH "%%B;%OWNPATH%tex\texmf-%PLATFORM%\bin" /M ) ) ) rem EOF Another possibility would be to define CONTEXT_HOME as an unexpanded value added to both the system environment variables and the PATH variable. For example (haven't tried it): setx CONTEXT_HOME "%OWNPATH%tex\texmf-%PLATFORM%\bin" setx PATH "%%B;%%CONTEXT_HOME%%" The advantage with this pattern is that subsequent updates need only check for CONTEXT_HOME and change its value without having to worry about PATH parsing, which can be hairy. Yet another option to consider is changing the value for only the existing user, rather than system-wide. Perhaps two different batch files? The reason for this change is because the Windows installation instructions (on the wiki) are incomplete: technically, the user must run setpath.bat for each new session. This implies that any third-party program that wants to make use of ConTeXt on Windows would have to communicate said fact to the user, or let the user set the full path to ConTeXt within the third-party program. Both of these can be avoided by persisting the PATH setting across sessions. Thank you! P.S. Pasted: https://pastebin.com/qpsqXZNB --00000000000033f98905c1ea7ad7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thoughts on updating the setpath.bat file to persist = setting the path?

Here's an updated version th= at sets the system environment variable while preserving the existing unexp= anded PATH value:

rem SOF
echo off
set OWNPATH=3D%~dp0
set PLATFORM=3Dmswin

if defined= ProgramFiles(x86) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0set PLATFORM=3Dwin64
if "%PROCESSOR_ARCH= ITECTURE%"=3D=3D"AMD64" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0set PLATFORM=3Dwin64
if exist "%OWNPATH%tex\texmf-mswi= n\bin\context.exe" set PLATFORM=3Dmswin
if exist "%OWNPATH%tex= \texmf-win64\bin\context.exe" set PLATFORM=3Dwin64

echo %PATH% = | findstr "texmf-%PLATFORM%" > nul

rem Only update the = PATH if not previously updated
if ERRORLEVEL 1 (
=C2=A0 set Key=3D&qu= ot;HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment"<= br>=C2=A0 set "CurrPath=3D"
=C2=A0 for /F "USEBACKQ token= s=3D2*" %%A in (`reg query %%Key%% /v PATH`) do (
=C2=A0 =C2=A0 if = not "%%~B" =3D=3D "" (
=C2=A0 =C2=A0 =C2=A0 rem Pres= erve the existing PATH
=C2=A0 =C2=A0 =C2=A0 echo %%B > currpath.txt
=C2=A0 =C2=A0 =C2=A0 rem Update the current session
=C2=A0 =C2=A0 = =C2=A0 set PATH=3D%PATH%;%OWNPATH%tex\texmf-%PLATFORM%\bin
=C2=A0 =C2=A0= =C2=A0
=C2=A0 =C2=A0 =C2=A0 rem Change the PATH environment variable=C2=A0 =C2=A0 =C2=A0 setx PATH "%%B;%OWNPATH%tex\texmf-%PLATFORM%\bi= n" /M
=C2=A0 =C2=A0 )
=C2=A0 )
)
rem EOF

Another = possibility would be to define CONTEXT_HOME as an unexpanded value added to= both the system environment variables and=C2=A0 the PATH variable. For exa= mple (haven't tried it):

setx CONTE= XT_HOME "%OWNPATH%tex\texmf-%PLATFORM%\bin"
setx PATH &= quot;%%B;%%CONTEXT_HOME%%"

The advantage = with this pattern is that subsequent updates need only check for CONTEXT_HO= ME and change its value without having to worry about PATH parsing, which c= an be hairy.

Yet another option to consider is cha= nging the value for only the existing user, rather than system-wide. Perhap= s two different batch files?

The reason for this c= hange is because the Windows installation instructions (on the wiki) are in= complete: technically, the user must run setpath.bat for each new session. = This implies that any third-party program that wants to make use of ConTeXt= on Windows would have to communicate said fact to the user, or let the use= r set the full path to ConTeXt within the third-party program. Both of thes= e can be avoided by persisting the PATH setting across sessions.
<= div>
Thank you!

P.S.
--00000000000033f98905c1ea7ad7-- --===============7006889668737324945== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============7006889668737324945==--