You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Mladen Turk <mt...@apache.org> on 2004/01/30 10:35:31 UTC

[PATCH] Recursively create directories

Hi,

Current FSDirectory uses mkdir() to create the index directory.
This patch uses mkdirs() allowing to create a 'deeper' structure like
'/opt/lucene/indexes/webindex',  etc...



RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.
java,v
retrieving revision 1.21
diff -u -r1.21 FSDirectory.java
--- FSDirectory.java	25 Sep 2003 21:50:11 -0000	1.21
+++ FSDirectory.java	30 Jan 2004 09:19:57 -0000
@@ -156,7 +156,7 @@
 
   private synchronized void create() throws IOException {
     if (!directory.exists())
-      if (!directory.mkdir())
+      if (!directory.mkdirs())
         throw new IOException("Cannot create directory: " + directory);
 
     String[] files = directory.list();            // clear old files



---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: [PATCH] Recursively create directories

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
This seems a reasonable change to avoid having to create the parent  
directory all the time.

Any negatives to doing this?

On Jan 30, 2004, at 4:35 AM, Mladen Turk wrote:

>
> Hi,
>
> Current FSDirectory uses mkdir() to create the index directory.
> This patch uses mkdirs() allowing to create a 'deeper' structure like
> '/opt/lucene/indexes/webindex',  etc...
>
>
>
> RCS file:
> /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/store/ 
> FSDirectory.
> java,v
> retrieving revision 1.21
> diff -u -r1.21 FSDirectory.java
> --- FSDirectory.java	25 Sep 2003 21:50:11 -0000	1.21
> +++ FSDirectory.java	30 Jan 2004 09:19:57 -0000
> @@ -156,7 +156,7 @@
>
>    private synchronized void create() throws IOException {
>      if (!directory.exists())
> -      if (!directory.mkdir())
> +      if (!directory.mkdirs())
>          throw new IOException("Cannot create directory: " +  
> directory);
>
>      String[] files = directory.list();            // clear old files
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: [PATCH] Recursively create directories

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Applied, hvala.

Otis

--- Mladen Turk <mt...@apache.org> wrote:
> 
> Hi,
> 
> Current FSDirectory uses mkdir() to create the index directory.
> This patch uses mkdirs() allowing to create a 'deeper' structure like
> '/opt/lucene/indexes/webindex',  etc...
> 
> 
> 
> RCS file:
>
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.
> java,v
> retrieving revision 1.21
> diff -u -r1.21 FSDirectory.java
> --- FSDirectory.java	25 Sep 2003 21:50:11 -0000	1.21
> +++ FSDirectory.java	30 Jan 2004 09:19:57 -0000
> @@ -156,7 +156,7 @@
>  
>    private synchronized void create() throws IOException {
>      if (!directory.exists())
> -      if (!directory.mkdir())
> +      if (!directory.mkdirs())
>          throw new IOException("Cannot create directory: " +
> directory);
>  
>      String[] files = directory.list();            // clear old files
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Re: [PATCH] Recursively create directories

Posted by Otis Gospodnetic <ot...@yahoo.com>.
Perche no.  I don't understand why we didn't have that in the first
place.

Otis (can't commit now, will do it later today) Gospodnetic

--- Mladen Turk <mt...@apache.org> wrote:
> 
> Hi,
> 
> Current FSDirectory uses mkdir() to create the index directory.
> This patch uses mkdirs() allowing to create a 'deeper' structure like
> '/opt/lucene/indexes/webindex',  etc...
> 
> 
> 
> RCS file:
>
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.
> java,v
> retrieving revision 1.21
> diff -u -r1.21 FSDirectory.java
> --- FSDirectory.java	25 Sep 2003 21:50:11 -0000	1.21
> +++ FSDirectory.java	30 Jan 2004 09:19:57 -0000
> @@ -156,7 +156,7 @@
>  
>    private synchronized void create() throws IOException {
>      if (!directory.exists())
> -      if (!directory.mkdir())
> +      if (!directory.mkdirs())
>          throw new IOException("Cannot create directory: " +
> directory);
>  
>      String[] files = directory.list();            // clear old files
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org