~skeeto/public-inbox

2 2

Re: Well-behaved alias commands on Windows

Details
Message ID
<530ba603-469c-3d36-9f37-60c2ea8a64d4@fblz.de>
DKIM signature
pass
Download raw message
Hi

I find this interesting from a different standpoint: PATH management
For me in Windows this is a pain. Say I want to put notepad++.exe on my 
PATH:
1.) I put 'C:\Program Files\Notepad++' into PATH > there is also 
uninstall.exe in this directory, which is now in PATH too...
2.) I create a directory, put in a .cmd or .bat and now put that 
directory into PATH. > Terminate batch job (Y/N)?
3.) I put the .bat into System32 (vim for Windows does this) > same as 
2.) but now also needs admin permissions to "install"

Would it be possible to modify alias.c to create a small launcher 
program that can be placed into PATH?

BR

Re: Well-behaved alias commands on Windows

Details
Message ID
<20220928003814.2er4fmiyijbms43i@nullprogram.com>
In-Reply-To
<530ba603-469c-3d36-9f37-60c2ea8a64d4@fblz.de> (view parent)
DKIM signature
missing
Download raw message
Yeah, Notepad++'s uninstall.exe is PATH-hostile and poor planning. In 
other cases even adjacent DLLs can get in the way since they're eligible 
for resolving dependencies. Notepad++ is a good candidate for a command 
alias.

You don't need to modify alias.c to achieve this, though. You only need to 
provide a path relative to the alias program. For example, if you have a 
"bin" directory in your profile directory (assuming standard location), 
you can install the alias in there with this EXE path:

gcc -DEXE="../../../Program Files/Notepad++/notepad++.exe" ...

Since that's awkward, I just modified alias.c to support absolute paths 
starting with a drive. See w64devkit commit 0b63b1c. That permits:

gcc -DEXE="C:/Program Files/Notepad++/notepad++.exe" ...

The alias can live anywhere or be moved around. The absolute vs. relative 
branch is trivially resolved at compile time since it's conditional on a 
constant, so this change was free.

Re: Well-behaved alias commands on Windows

Details
Message ID
<75299f65-bfd0-44fb-7522-acadd72cd137@fblz.de>
In-Reply-To
<20220928003814.2er4fmiyijbms43i@nullprogram.com> (view parent)
DKIM signature
pass
Download raw message
Yeah, unfortunately, many popular applications do this cluttering of the 
binary directory...

I have my home on the D: drive, so I just tried absolute paths which 
obviously failed before your adjustments.

My path is already cleared from a bunch of .bat files now, which is 
awesome :) Thank you for that.

The only *minor* annoyance with GUI apps like notepad++ is that if they 
are not running already, the terminal will be blocked until you either 
ctrl+c or exit the app. But I have a hunch that fixing this is harder 
then what it is worth.
Reply to thread Export thread (mbox)