[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r6763 - GNUnet/src/applications/fs/fsui
From: |
gnunet |
Subject: |
[GNUnet-SVN] r6763 - GNUnet/src/applications/fs/fsui |
Date: |
Fri, 25 Apr 2008 21:52:10 -0600 (MDT) |
Author: holindho
Date: 2008-04-25 21:52:10 -0600 (Fri, 25 Apr 2008)
New Revision: 6763
Modified:
GNUnet/src/applications/fs/fsui/download.c
GNUnet/src/applications/fs/fsui/upload.c
Log:
fix empty directory handling in recursive downloads
Modified: GNUnet/src/applications/fs/fsui/download.c
===================================================================
--- GNUnet/src/applications/fs/fsui/download.c 2008-04-25 23:03:42 UTC (rev
6762)
+++ GNUnet/src/applications/fs/fsui/download.c 2008-04-26 03:52:10 UTC (rev
6763)
@@ -182,16 +182,19 @@
GNUNET_ECRS_meta_data_destroy (md);
if (dl->is_recursive)
{
+ int n;
/* load directory, start downloads */
md = NULL;
GNUNET_mutex_lock (dl->ctx->lock);
- GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
- dirBlock,
- totalBytes,
- &md,
- &triggerRecursiveDownload,
- dl);
+ n = GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
+ dirBlock,
+ totalBytes,
+ &md,
+
&triggerRecursiveDownload,
+ dl);
GNUNET_mutex_unlock (dl->ctx->lock);
+ if (n == 0)
+ GNUNET_disk_directory_create (dl->ctx->ectx, dl->filename);
GNUNET_ECRS_meta_data_destroy (md);
MUNMAP (dirBlock, totalBytes);
}
@@ -297,13 +300,16 @@
}
if ((dl->is_recursive == GNUNET_YES) && (dl->is_directory == GNUNET_YES))
{
+ int n;
md = NULL;
GNUNET_mutex_lock (dl->ctx->lock);
- GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
- lastBlock,
- lastBlockSize, &md,
- &triggerRecursiveDownload, dl);
+ n = GNUNET_ECRS_directory_list_contents (dl->ctx->ectx,
+ lastBlock,
+ lastBlockSize, &md,
+ &triggerRecursiveDownload, dl);
GNUNET_mutex_unlock (dl->ctx->lock);
+ if (n == 0)
+ GNUNET_disk_directory_create (dl->ctx->ectx, dl->filename);
if (md != NULL)
GNUNET_ECRS_meta_data_destroy (md);
}
Modified: GNUnet/src/applications/fs/fsui/upload.c
===================================================================
--- GNUnet/src/applications/fs/fsui/upload.c 2008-04-25 23:03:42 UTC (rev
6762)
+++ GNUnet/src/applications/fs/fsui/upload.c 2008-04-26 03:52:10 UTC (rev
6763)
@@ -293,6 +293,7 @@
GNUNET_FSUI_Event event;
GNUNET_ECRS_FileInfo fi;
int ret;
+ int is_directory;
struct GNUNET_GE_Context *ectx;
char *filename;
char *pfn;
@@ -319,6 +320,7 @@
if (GNUNET_YES == GNUNET_disk_directory_test (ectx, utc->filename))
{
error = NULL;
+ is_directory = 1;
filename = createDirectoryHelper (ectx,
utc->shared->ctx->cfg,
utc->child, utc->meta, &error);
@@ -334,6 +336,7 @@
}
else
{
+ is_directory = 0;
filename = GNUNET_strdup (utc->filename);
}
utc->start_time = GNUNET_get_time ();
@@ -403,7 +406,7 @@
tpos--;
pfn = GNUNET_malloc (strlen (&utc->filename[tpos + 1]) + 2);
strcpy (pfn, &utc->filename[tpos + 1]);
- if ((utc->child != NULL) &&
+ if ((is_directory || (utc->child != NULL)) &&
((strlen (pfn) == 0) || (pfn[strlen (pfn) - 1] != DIR_SEPARATOR)))
strcat (pfn, DIR_SEPARATOR_STR);
GNUNET_ECRS_meta_data_insert (utc->meta, EXTRACTOR_FILENAME, pfn);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r6763 - GNUnet/src/applications/fs/fsui,
gnunet <=