[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r2563 - gnunet-gtk/src/plugins/fs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r2563 - gnunet-gtk/src/plugins/fs |
Date: |
Sat, 18 Mar 2006 12:33:37 -0800 (PST) |
Author: grothoff
Date: 2006-03-18 12:33:35 -0800 (Sat, 18 Mar 2006)
New Revision: 2563
Modified:
gnunet-gtk/src/plugins/fs/download.c
Log:
fix
Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c 2006-03-17 23:54:16 UTC (rev
2562)
+++ gnunet-gtk/src/plugins/fs/download.c 2006-03-18 20:33:35 UTC (rev
2563)
@@ -119,7 +119,10 @@
GtkTreeIter iiter;
GtkWidget * spin;
const char * name;
+ const char * oname;
+ const char * cname;
const char * mime;
+ char * dname;
unsigned int anon;
GtkTreePath *dirTreePath;
char *dirPath;
@@ -174,21 +177,51 @@
return;
}
- if (name == NULL)
+ if (name == NULL) {
#ifdef WINDOWS
- {
filehash = STRDUP(uri_name);
filehash[16] = 0;
name = filehash;
- }
#else
name = uri_name;
#endif
+ }
+ cname = name;
+ oname = name;
+ dname = MALLOC(strlen(name)+1);
+ dname[0] = '\0';
+ while (*name != '\0') {
+ if ( (*name == DIR_SEPARATOR) &&
+ (name[1] != '\0') ) {
+ memcpy(dname, oname, name - oname);
+ dname[name - oname] = '\0';
+ cname = &name[1];
+ }
+ name++;
+ }
+ if (*cname == '\0') /* name ended in '/' - likely directory */
+ cname = oname;
+ name = cname;
+
final_download_dir = getFileName("FS",
"INCOMINGDIR",
_("You must specify a directory in the
configuration"
" in section `%s' under `%s'."));
+ if (strlen(dname) > 0) {
+ char * tmp;
+ tmp = MALLOC(strlen(final_download_dir) + strlen(dname) + 2);
+ strcpy(tmp, final_download_dir);
+ if (tmp[strlen(tmp)] != DIR_SEPARATOR)
+ strcat(tmp, DIR_SEPARATOR_STR);
+ if (dname[0] == DIR_SEPARATOR)
+ strcat(tmp, &dname[1]);
+ else
+ strcat(tmp, dname);
+ FREE(final_download_dir);
+ final_download_dir = tmp;
+ }
+ FREE(dname);
mkdirp(final_download_dir);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r2563 - gnunet-gtk/src/plugins/fs,
grothoff <=