(selected_file []FILE_REQUEST)
| 837 | |
| 838 | |
| 839 | func CopySelectedFile(selected_file []FILE_REQUEST) { |
| 840 | Copy := func(src string, dst string) { |
| 841 | src_info, err := os.Stat(src) |
| 842 | if err != nil { |
| 843 | return |
| 844 | } |
| 845 | if src_info.IsDir() { |
| 846 | if err := CopyDirectory(src, dst); err != nil { |
| 847 | return |
| 848 | } |
| 849 | } else { |
| 850 | if err := CopyFile(src, dst); err != nil { |
| 851 | return |
| 852 | } |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | for _, file := range selected_file { |
| 857 | if !AccessSuperPath(file.Path) { |
| 858 | // 禁止越界拷贝文件. |
| 859 | continue |
| 860 | } |
| 861 | Copy( |
| 862 | filepath.Join(SHARE_DIR, file.Path), |
| 863 | filepath.Join(SHARE_DIR, file.CurrentDir, filepath.Base(file.Path)), |
| 864 | ) |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | |
| 869 | // 移动被选中的文件. |
no test coverage detected