File src/filelist.c changed (mode: 100644) (index 926752e1e..ce11119d8) |
... |
... |
leave_invalid_dir(FileView *view, char *path) |
911 |
911 |
* or an absolute path - /usr/local/share |
* or an absolute path - /usr/local/share |
912 |
912 |
* The *directory passed to change_directory() cannot be modified. |
* The *directory passed to change_directory() cannot be modified. |
913 |
913 |
* Symlink directories require an absolute path |
* Symlink directories require an absolute path |
|
914 |
|
* |
|
915 |
|
* Returns 0 if there was no errors. |
914 |
916 |
*/ |
*/ |
915 |
|
void |
|
|
917 |
|
int |
916 |
918 |
change_directory(FileView *view, const char *directory) |
change_directory(FileView *view, const char *directory) |
917 |
919 |
{ |
{ |
918 |
920 |
DIR *dir; |
DIR *dir; |
|
... |
... |
change_directory(FileView *view, const char *directory) |
970 |
972 |
werase(status_bar); |
werase(status_bar); |
971 |
973 |
show_error_msg("FUSE UMOUNT ERROR", runner->source_file_name); |
show_error_msg("FUSE UMOUNT ERROR", runner->source_file_name); |
972 |
974 |
chdir(view->curr_dir); |
chdir(view->curr_dir); |
973 |
|
return; |
|
|
975 |
|
return -1; |
974 |
976 |
} |
} |
975 |
977 |
/*remove the DIR we created for the mount*/ |
/*remove the DIR we created for the mount*/ |
976 |
978 |
if(!access(runner->mount_point, F_OK)) |
if(!access(runner->mount_point, F_OK)) |
|
... |
... |
change_directory(FileView *view, const char *directory) |
994 |
996 |
found = find_file_pos_in_list(view, filen); |
found = find_file_pos_in_list(view, filen); |
995 |
997 |
moveto_list_pos(view, found); |
moveto_list_pos(view, found); |
996 |
998 |
free(runner); |
free(runner); |
997 |
|
return; |
|
|
999 |
|
return 0; |
998 |
1000 |
} |
} |
999 |
1001 |
} |
} |
1000 |
1002 |
|
|
|
... |
... |
change_directory(FileView *view, const char *directory) |
1087 |
1089 |
leave_invalid_dir(view, dir_dup); |
leave_invalid_dir(view, dir_dup); |
1088 |
1090 |
change_directory(view, dir_dup); |
change_directory(view, dir_dup); |
1089 |
1091 |
clean_selected_files(view); |
clean_selected_files(view); |
1090 |
|
return; |
|
|
1092 |
|
return -1; |
1091 |
1093 |
} |
} |
1092 |
1094 |
|
|
1093 |
1095 |
if(access(dir_dup, R_OK) != 0) |
if(access(dir_dup, R_OK) != 0) |
|
... |
... |
change_directory(FileView *view, const char *directory) |
1096 |
1098 |
"You do not have read access on that directory"); |
"You do not have read access on that directory"); |
1097 |
1099 |
|
|
1098 |
1100 |
clean_selected_files(view); |
clean_selected_files(view); |
1099 |
|
return; |
|
|
1101 |
|
return -1; |
1100 |
1102 |
} |
} |
1101 |
1103 |
|
|
1102 |
1104 |
if(access(dir_dup, X_OK) != 0) |
if(access(dir_dup, X_OK) != 0) |
|
... |
... |
change_directory(FileView *view, const char *directory) |
1105 |
1107 |
"You do not have execute access on that directory"); |
"You do not have execute access on that directory"); |
1106 |
1108 |
|
|
1107 |
1109 |
clean_selected_files(view); |
clean_selected_files(view); |
1108 |
|
return; |
|
|
1110 |
|
return -1; |
1109 |
1111 |
} |
} |
1110 |
1112 |
|
|
1111 |
1113 |
dir = opendir(dir_dup); |
dir = opendir(dir_dup); |
|
... |
... |
change_directory(FileView *view, const char *directory) |
1114 |
1116 |
{ |
{ |
1115 |
1117 |
show_error_msg("Dir is null", "Could not open directory. "); |
show_error_msg("Dir is null", "Could not open directory. "); |
1116 |
1118 |
clean_selected_files(view); |
clean_selected_files(view); |
1117 |
|
return; |
|
|
1119 |
|
return -1; |
1118 |
1120 |
} |
} |
1119 |
1121 |
|
|
1120 |
1122 |
if(chdir(dir_dup) == -1) |
if(chdir(dir_dup) == -1) |
1121 |
1123 |
{ |
{ |
1122 |
1124 |
closedir(dir); |
closedir(dir); |
1123 |
1125 |
status_bar_message("Couldn't open directory"); |
status_bar_message("Couldn't open directory"); |
1124 |
|
return; |
|
|
1126 |
|
return -1; |
1125 |
1127 |
} |
} |
1126 |
1128 |
|
|
1127 |
1129 |
clean_selected_files(view); |
clean_selected_files(view); |
|
... |
... |
change_directory(FileView *view, const char *directory) |
1142 |
1144 |
closedir(dir); |
closedir(dir); |
1143 |
1145 |
|
|
1144 |
1146 |
save_view_history(view); |
save_view_history(view); |
|
1147 |
|
return 0; |
1145 |
1148 |
} |
} |
1146 |
1149 |
|
|
1147 |
1150 |
static void |
static void |
|
... |
... |
load_dir_list(FileView *view, int reload) |
1367 |
1370 |
draw_dir_list(view, view->top_line, view->list_pos); |
draw_dir_list(view, view->top_line, view->list_pos); |
1368 |
1371 |
} |
} |
1369 |
1372 |
|
|
1370 |
|
bool |
|
1371 |
|
is_link_dir(const dir_entry_t * path) |
|
1372 |
|
{ |
|
1373 |
|
struct stat s; |
|
1374 |
|
stat(path->name, &s); |
|
1375 |
|
|
|
1376 |
|
//if(s.st_mode & S_IFMT == S_IFDIR) return true; |
|
1377 |
|
if(s.st_mode & S_IFDIR) |
|
1378 |
|
return true; |
|
1379 |
|
else |
|
1380 |
|
return false; |
|
1381 |
|
} |
|
1382 |
|
|
|
1383 |
1373 |
void |
void |
1384 |
1374 |
filter_selected_files(FileView *view) |
filter_selected_files(FileView *view) |
1385 |
1375 |
{ |
{ |
|
... |
... |
check_if_filelists_have_changed(FileView *view) |
1575 |
1565 |
|
|
1576 |
1566 |
if(stat(view->curr_dir, &s) != 0) |
if(stat(view->curr_dir, &s) != 0) |
1577 |
1567 |
{ |
{ |
1578 |
|
show_error_msg(" Directory Access Error ", |
|
1579 |
|
"Cannot open directory"); |
|
|
1568 |
|
show_error_msg(" Directory Access Error ", "Cannot open directory"); |
1580 |
1569 |
leave_invalid_dir(view, view->curr_dir); |
leave_invalid_dir(view, view->curr_dir); |
1581 |
1570 |
change_directory(view, view->curr_dir); |
change_directory(view, view->curr_dir); |
1582 |
1571 |
clean_selected_files(view); |
clean_selected_files(view); |
File src/filelist.h changed (mode: 100644) (index 420625e52..bc1e3604d) |
... |
... |
void friendly_size_notation(unsigned long long num, int str_size, char *str); |
35 |
35 |
void quick_view_file(FileView * view); |
void quick_view_file(FileView * view); |
36 |
36 |
void clean_selected_files(FileView *view); |
void clean_selected_files(FileView *view); |
37 |
37 |
void goto_history_pos(FileView *view, int pos); |
void goto_history_pos(FileView *view, int pos); |
38 |
|
void change_directory(FileView *view, const char *directory); |
|
|
38 |
|
int change_directory(FileView *view, const char *directory); |
39 |
39 |
void load_dir_list(FileView *view, int reload); |
void load_dir_list(FileView *view, int reload); |
40 |
40 |
void draw_dir_list(FileView *view, int top, int pos); |
void draw_dir_list(FileView *view, int top, int pos); |
41 |
41 |
char * get_current_file_name(FileView *view); |
char * get_current_file_name(FileView *view); |
|
... |
... |
void get_all_selected_files(FileView *view); |
45 |
45 |
void get_selected_files(FileView *view, int count, int *indexes); |
void get_selected_files(FileView *view, int count, int *indexes); |
46 |
46 |
void free_selected_file_array(FileView *view); |
void free_selected_file_array(FileView *view); |
47 |
47 |
void erase_current_line_bar(FileView *view); |
void erase_current_line_bar(FileView *view); |
48 |
|
bool is_link_dir(const dir_entry_t * path); |
|
49 |
48 |
void filter_selected_files(FileView *view); |
void filter_selected_files(FileView *view); |
50 |
49 |
void hide_dot_files(FileView *view); |
void hide_dot_files(FileView *view); |
51 |
50 |
void show_dot_files(FileView *view); |
void show_dot_files(FileView *view); |