Changeset 13924
- Timestamp:
- Feb 1, 2013, 7:21:38 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r13913 r13924 2848 2848 for (f=0; f<tor->info.fileCount; ++f) 2849 2849 { 2850 char * dir; 2851 char * filename; 2852 2850 2853 /* get the directory that this file goes in... */ 2851 char * filename = tr_buildPath (top, tor->info.files[f].name, NULL); 2852 char * dir = tr_dirname (filename); 2854 filename = tr_buildPath (top, tor->info.files[f].name, NULL); 2855 dir = tr_dirname (filename); 2856 tr_free (filename); 2857 2858 /* walk up the directory tree until we reach 'top' */ 2853 2859 if (!tr_is_same_file (top, dir) && strcmp (top, dir)) { 2854 for (;;) { 2855 char * parent = tr_dirname (dir); 2856 const bool done_walking = tr_is_same_file (top, parent) || !strcmp (top, parent); 2857 if (done_walking && tr_ptrArrayFindSorted (&folders, dir, vstrcmp)) 2858 tr_ptrArrayInsertSorted (&folders, dir, vstrcmp); /* folders assumes ownership of dir */ 2859 else 2860 tr_free (dir); 2861 dir = parent; 2862 if (done_walking) 2860 for (;;) { 2861 char * parent = tr_dirname (dir); 2862 if (tr_is_same_file (top, parent) || !strcmp (top, parent)) { 2863 if (tr_ptrArrayFindSorted (&folders, dir, vstrcmp) == NULL) 2864 tr_ptrArrayInsertSorted (&folders, tr_strdup(dir), vstrcmp); 2865 tr_free (parent); 2863 2866 break; 2867 } 2868 2869 /* walk upwards to parent */ 2870 tr_free (dir); 2871 dir = parent; 2864 2872 } 2865 2873 } 2866 tr_free (dir); 2867 tr_free (filename); 2868 } 2874 2875 tr_free (dir); 2876 } 2877 2869 2878 for (i=0, n=tr_ptrArraySize (&folders); i<n; ++i) 2870 2879 removeEmptyFoldersAndJunkFiles (tr_ptrArrayNth (&folders, i));
Note: See TracChangeset
for help on using the changeset viewer.