移动被选中的文件.
(selected_file []FILE_REQUEST)
| 868 | |
| 869 | // 移动被选中的文件. |
| 870 | func MoveSelectedFile(selected_file []FILE_REQUEST) { |
| 871 | for _, file := range selected_file { |
| 872 | if !AccessSuperPath(file.Path) { |
| 873 | // 禁止越界移动文件. |
| 874 | continue |
| 875 | } |
| 876 | |
| 877 | _, err := os.Stat(filepath.Join(SHARE_DIR, file.CurrentDir, filepath.Base(file.Path))) |
| 878 | if err != nil { |
| 879 | // 没有目标文件. |
| 880 | err := os.Rename( |
| 881 | filepath.Join(SHARE_DIR, file.Path), |
| 882 | filepath.Join(SHARE_DIR, file.CurrentDir, filepath.Base(file.Path)), |
| 883 | ) |
| 884 | if err != nil { |
| 885 | continue |
| 886 | } |
| 887 | } else { |
| 888 | // 有目标文件, 跳过本次循环的移动. |
| 889 | continue |
| 890 | } |
| 891 | } |
| 892 | } |
| 893 | |
| 894 | |
| 895 | // 获取路径的文件扩展. |
no test coverage detected