zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: _store_cache allows cache names to contain /
@ 2002-10-09  4:22 Felix Rosencrantz
  2002-10-09  9:35 ` Peter Stephenson
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Rosencrantz @ 2002-10-09  4:22 UTC (permalink / raw)
  To: zsh-workers

I mentioned this change some time back, to allow cache names to be pathnames.

Here is the patch:
Index: Completion/Base/Utility/_store_cache
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_store_cache,v
retrieving revision 1.2
diff -u -r1.2 _store_cache
--- Completion/Base/Utility/_store_cache	16 Apr 2002 07:48:45 -0000	1.2
+++ Completion/Base/Utility/_store_cache	8 Oct 2002 06:31:44 -0000
@@ -2,7 +2,7 @@
 #
 # Storage component of completions caching layer
 
-local _cache_ident
+local _cache_ident _cache_ident_dir
 _cache_ident="$1"
 
 if zstyle -t ":completion:${curcontext}:" use-cache; then
@@ -13,13 +13,28 @@
     if [[ -e "$_cache_dir" ]]; then
       _message "cache-dir style points to a non-directory\!"
     else
-      mkdir -p "$_cache_dir"
+      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_dir" )
       if [[ ! -d "$_cache_dir" ]]; then
         _message "couldn't create cache-dir $_cache_dir"
         return 1
       fi
     fi
   fi
+  _cache_ident_dir="$_cache_dir/$_cache_ident"
+  _cache_ident_dir="$_cache_ident_dir:h"
+  
+  if [[ ! -d "$_cache_ident_dir" ]]; then
+    if [[ -e "$_cache_ident_dir" ]]; then
+      _message "cache ident dir points to a non-directory:$_cache_ident_dir"
+    else
+      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_ident_dir")
+      if [[ ! -d "$_cache_ident_dir" ]]; then
+        _message "couldn't create cache-ident_dir $_cache_ident_dir"
+        return 1
+      fi
+    fi
+  fi
+  
 
   shift
   for var; do





__________________________________________________
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _store_cache allows cache names to contain /
  2002-10-09  4:22 PATCH: _store_cache allows cache names to contain / Felix Rosencrantz
@ 2002-10-09  9:35 ` Peter Stephenson
  2002-10-09 15:11   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Stephenson @ 2002-10-09  9:35 UTC (permalink / raw)
  To: Zsh hackers list

Felix Rosencrantz wrote:
> +      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_dir" )
> +      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_ident_dir")

It's slightly better practice to use `zmodload -i zsh/files', although
it's not going to make a difference here.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: _store_cache allows cache names to contain /
  2002-10-09  9:35 ` Peter Stephenson
@ 2002-10-09 15:11   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2002-10-09 15:11 UTC (permalink / raw)
  To: Zsh hackers list

On Oct 9, 10:35am, Peter Stephenson wrote:
} Subject: Re: PATCH: _store_cache allows cache names to contain /
}
} Felix Rosencrantz wrote:
} > +      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_dir" )
} > +      (zmodload zsh/files 2>/dev/null; mkdir -p "$_cache_ident_dir")
} 
} It's slightly better practice to use `zmodload -i zsh/files'

I actually recommended against that for this case, because the redirection
to /dev/null is necessary to suppress failure messages whether or not the
module is already loaded; the -i adds nothing.  See zsh-workers/17649.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-10-09 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-09  4:22 PATCH: _store_cache allows cache names to contain / Felix Rosencrantz
2002-10-09  9:35 ` Peter Stephenson
2002-10-09 15:11   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).