Skip to content
Snippets Groups Projects
Commit d8058362 authored by Yorhel's avatar Yorhel
Browse files

Actually delete parents as well when deleting directories

parent ba4d06e0
No related branches found
No related tags found
No related merge requests found
...@@ -184,7 +184,7 @@ int delete_key(int ch) { ...@@ -184,7 +184,7 @@ int delete_key(int ch) {
} }
struct dir *delete_dir(struct dir *dr) { int delete_dir(struct dir *dr) {
struct dir *nxt, *cur; struct dir *nxt, *cur;
int r; int r;
char file[PATH_MAX]; char file[PATH_MAX];
...@@ -196,8 +196,8 @@ struct dir *delete_dir(struct dir *dr) { ...@@ -196,8 +196,8 @@ struct dir *delete_dir(struct dir *dr) {
/* check for input or screen resizes */ /* check for input or screen resizes */
strcpy(curfile, file); strcpy(curfile, file);
if(input_handle(1)) if(input_handle(0))
return root; return 1;
/* do the actual deleting */ /* do the actual deleting */
if(dr->flags & FF_DIR) { if(dr->flags & FF_DIR) {
...@@ -206,8 +206,8 @@ struct dir *delete_dir(struct dir *dr) { ...@@ -206,8 +206,8 @@ struct dir *delete_dir(struct dir *dr) {
while(nxt != NULL) { while(nxt != NULL) {
cur = nxt; cur = nxt;
nxt = cur->next; nxt = cur->next;
if(delete_dir(cur) == root) if(delete_dir(cur))
return root; return 1;
} }
} }
r = rmdir(file); r = rmdir(file);
...@@ -220,14 +220,16 @@ struct dir *delete_dir(struct dir *dr) { ...@@ -220,14 +220,16 @@ struct dir *delete_dir(struct dir *dr) {
lasterrno = errno; lasterrno = errno;
while(state == DS_FAILED) while(state == DS_FAILED)
if(input_handle(0)) if(input_handle(0))
return root; return 1;
} }
return freedir(dr); freedir(dr);
return 0;
} }
void delete_process() { void delete_process() {
struct dir *n = root->parent;
/* confirm */ /* confirm */
seloption = 1; seloption = 1;
while(state == DS_CONFIRM && !noconfirm) while(state == DS_CONFIRM && !noconfirm)
...@@ -237,7 +239,10 @@ void delete_process() { ...@@ -237,7 +239,10 @@ void delete_process() {
/* delete */ /* delete */
lastupdate = 999; lastupdate = 999;
seloption = 0; seloption = 0;
return browse_init(delete_dir(root)); if(delete_dir(root))
browse_init(root);
else
browse_init(n);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment