summaryrefslogtreecommitdiffstats
path: root/src/dirn.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-01-19 11:40:23 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-01-19 11:40:23 +0100
commit66d99f2ae56be32c2ccfb4cf690f93f90d44bb2e (patch)
treee6f992f253f1f90cb4f24f1de458e92fe4702a44 /src/dirn.c
parent05dfc5ce793d88a84603038b8835468ddbd2b7b3 (diff)
When copying files, ask for the target directory again if the source directory has changed
Diffstat (limited to 'src/dirn.c')
-rw-r--r--src/dirn.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/dirn.c b/src/dirn.c
index 094579c..0f458eb 100644
--- a/src/dirn.c
+++ b/src/dirn.c
@@ -61,6 +61,7 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
* other: new inode
* */
int quit=0;
+ int ask_destination=1;
WINDOW *window=(WINDOW*)dir_data->display;
do
{
@@ -347,14 +348,17 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
strcat(dir_data->current_directory,"/");
if(strcmp(pos->name,".")!=0)
strcat(dir_data->current_directory,pos->name);
- if(dir_data->local_dir==NULL)
+ if(dir_data->local_dir==NULL || ask_destination>0)
{
+ char *local_dir=dir_data->local_dir;
if(LINUX_S_ISDIR(pos->st_mode)!=0)
dir_data->local_dir=ask_location("Please select a destination where %s and any files below will be copied.",
- dir_data->current_directory, NULL);
+ dir_data->current_directory, local_dir);
else
dir_data->local_dir=ask_location("Please select a destination where %s will be copied.",
- dir_data->current_directory, NULL);
+ dir_data->current_directory, local_dir);
+ free(local_dir);
+ ask_destination=0;
}
if(dir_data->local_dir!=NULL)
{
@@ -402,9 +406,12 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
case 'C':
if(dir_data->copy_file!=NULL)
{
- if(dir_data->local_dir==NULL)
+ if(dir_data->local_dir==NULL || ask_destination>0)
{
- dir_data->local_dir=ask_location("Please select a destination where the marked files will be copied.", NULL, NULL);
+ char *local_dir=dir_data->local_dir;
+ dir_data->local_dir=ask_location("Please select a destination where the marked files will be copied.", NULL, local_dir);
+ free(local_dir);
+ ask_destination=0;
}
if(dir_data->local_dir!=NULL)
{