Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Injected-Via-Gmane: http://gmane.org/ To: cygwin AT cygwin DOT com From: Soren A Subject: Re: example needed pls: `cygpath -c ' Date: Wed, 2 Jul 2003 11:03:42 +0000 (UTC) Organization: Occasionally Sporadically Lines: 140 Message-ID: References: <3EFE120B DOT 58A0C79E AT dessent DOT net> <20030701040434 DOT GE7604 AT ny-kenton2a-710 DOT buf DOT adelphia DOT net> <3F018740 DOT B28F53DC AT dessent DOT net> <3F018D6C DOT EA1226CA AT dessent DOT net> <3F021C46 DOT C8F4CE31 AT dessent DOT net> X-Complaints-To: usenet AT main DOT gmane DOT org User-Agent: Xnews/L5 X-Archive: encrypt Soren A wrote around 02 Jul 2003 news:Xns93AC469331861soren1Gmane AT 80 DOT 91 DOT 224 DOT 249: > Attachment: CygPathExpandSZ.reg > Attachment: REGexpandSZgen.p My newsreader is buggy, if I attach it makes the body text just vanish. Here's what accompanied those attached files when I hit "send" 10 minutes ago: ------------------------------------------------------------------- Brian Dessent wrote around 01 Jul 2003 news:3F021C46 DOT C8F4CE31 AT dessent DOT net: > I think by default it tries to use short-filenames in some cases, and > so %L means the same as %1 except it uses long file names. Well you are so right. And your knowledge about this stuff inspired me to forge onward in pursuit of inspiration. I have dressed up your .reg file a bit (heheh) and now give it back to you ... mutated beyond recognition ... (also attached to [previous] posting, so don't sweat) ----- 8< ----- snip and de-indent and de-wrap ----- 8< ----- REGEDIT4 [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN] @="&Copy LFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN\Command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,6c,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN] @="&Copy LFN Cygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN\command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,6c,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN] @="&Copy SFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN\Command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,31,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN] @="&Copy SFN Cygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN\command] @=hex(2):22,25,43,59,47,52,4f,4f,54,25,5c,5c,62,69,6e,5c,5c,62,61,73,68,20 ,2d,63,20,5c,22,65,63,68,6f,20,2d,6e,20,60,2f,62,69,6e,2f,63,79,67,70,61,74 ,68,20,2d,75,20,27,25,31,27,60,3e,2f,64,65,76,2f,63,6c,69,70,62,6f,61,72,64 ,5c,22,22,d,00 ----- 8< ----- snip and de-indent and de-wrap ----- 8< ----- OK, "what's UP with this bizarre thing?" It is a REG_EXPAND_SZ -type REGEDIT .reg file instead of using easy REG_SZ -type entries. The expansion encoded is of a variable %CYGROOT% which must be present in the Windows "master" environment, so that the Registry _always_ has access to it. I set it in my Windows9x autoexec.bat file of course, and under NT/2K/XP you can use the ControlPanel|System. I really feel that %CYGROOT% is a broadly useful thing to do. Point it at the top (mounted as /) of your Cygwin installation and you'll always have programmatic access to the Cygwin location from outside in the 'doze wilderness. It's always nice to know where your safe haven is located, no? This is a typical Cygwin installation example of %CYGROOT%: SET CYGROOT=C:\cygwin (in autoexec.bat). So when I run the file above (I named it "CygPathExpandSZ.reg"), the Registry entries thus created are expanded with the result that whatever is in %CYGROOT% gets prepended to locate bash in cygwin's /bin. This makes your .reg concept portable without manual editing, to any system that has the %CYGROOT% variable defined in the env (obviously that's not very many since this isn't any part of Official Cygwin). Since you cannot (easily) read it you'll have to trust me that what I've described is what it does ;-). But here's the file _before_ creating the right kind of entries (this *will not work* as a .REG file, it could be termed "Registry psuedo-code"): ----- 8< ----- snip ----- 8< ----- !nope!REGEDIT4 messed up by my news client! [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN] @="&Copy LFN Cygwin Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathLFN\Command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboard\" " [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN] @="&Copy LFN Cygwin pa th" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathLFN\command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%l'`>/dev/clipboa rd\"" [HKEY_CLASSES_ROOT\Directory\shell\CygPa thSFN] @="&Copy SFN Cygwi n Path" [HKEY_CLASSES_ROOT\Directory\shell\CygPathSFN\Command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%1'`>/dev/cli pboard\"" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN] @="&Copy SFN C ygwin path" [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\CygPathSFN\command] @="%CYGROOT%\\bin\\bash -c \"echo -n `/bin/cygpath -u '%1'`>/de v/clipboard\"" ----- 8< ----- snip ----- 8< ----- I manually calculated all the hex bytes with a slide rule. Hah! What a liar! Actually I wrote a Perl tool to generate the REG_EXPAND_SZ entries needed. That tool is attached to this message and can also be seen discussed on perlmonks.org (hint: monk "Intrepid"). Best Regards, Soren A. ------------------------------------------------------------------- -- "So, tell me, my little one-eyed one, on what poor, pitiful, defenseless planet has my MONSTROSITY been unleashed?" - Dr. Jumba, Disney's "Lilo & Stitch" OpenPGP Key at http://savannah.gnu.org/people/viewgpg.php?user_id=6050 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/