Changeset 289
- Timestamp:
- Jun 8, 2006, 4:25:14 AM (17 years ago)
- Location:
- branches/save_torrent_files/libtransmission
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/save_torrent_files/libtransmission/inout.c
r261 r289 206 206 207 207 int i; 208 char * path , * p;208 char * path; 209 209 struct stat sb; 210 210 int file; … … 217 217 218 218 /* Create folders */ 219 p = path; 220 while( ( p = strchr( p, '/' ) ) ) 221 { 222 *p = '\0'; 223 if( stat( path, &sb ) ) 224 { 225 /* Folder doesn't exist yet */ 226 mkdir( path, 0777 ); 227 } 228 else if( ( sb.st_mode & S_IFMT ) != S_IFDIR ) 229 { 230 /* Node exists but isn't a folder */ 231 printf( "Remove %s, it's in the way.\n", path ); 232 free( path ); 233 return 1; 234 } 235 *p = '/'; 236 p++; 219 if( tr_mkdir( path ) ) 220 { 221 free( path ); 222 return 1; 237 223 } 238 224 -
branches/save_torrent_files/libtransmission/metainfo.c
r288 r289 115 115 if( saveCopy ) 116 116 { 117 /* Create the private torrents directory */118 if( mkdir( tr_getTorrentsDirectory(), 0777 ) && EEXIST != errno )119 {120 fprintf( stderr, "Could not create directory (%s)\n",121 tr_getTorrentsDirectory() );122 tr_bencFree( &meta );123 free( buf );124 return 1;125 }126 127 117 /* Save a copy of the torrent file in the private torrent directory */ 128 118 snprintf( inf->torrent, MAX_PATH_LENGTH, "%s/%s", -
branches/save_torrent_files/libtransmission/platform.c
r288 r289 81 81 #endif 82 82 83 mkdir( prefsDirectory, 0777);83 tr_mkdir( prefsDirectory ); 84 84 init = 1; 85 85 … … 117 117 #endif 118 118 119 mkdir( cacheDirectory, 0777);119 tr_mkdir( cacheDirectory ); 120 120 init = 1; 121 121 … … 151 151 #endif 152 152 153 mkdir( torrentsDirectory, 0777);153 tr_mkdir( torrentsDirectory ); 154 154 init = 1; 155 155 -
branches/save_torrent_files/libtransmission/utils.c
r261 r289 94 94 return NULL; 95 95 } 96 97 int tr_mkdir( char * path ) 98 { 99 char * p; 100 struct stat sb; 101 102 p = path; 103 while( ( p = strchr( p, '/' ) ) ) 104 { 105 *p = '\0'; 106 if( stat( path, &sb ) ) 107 { 108 /* Folder doesn't exist yet */ 109 if( mkdir( path, 0777 ) ) 110 { 111 tr_err( "Could not create directory %s (%s)", path, 112 strerror( errno ) ); 113 *p = '/'; 114 return 1; 115 } 116 } 117 else if( ( sb.st_mode & S_IFMT ) != S_IFDIR ) 118 { 119 /* Node exists but isn't a folder */ 120 tr_err( "Remove %s, it's in the way.", path ); 121 *p = '/'; 122 return 1; 123 } 124 *p = '/'; 125 p++; 126 } 127 128 return 0; 129 } -
branches/save_torrent_files/libtransmission/utils.h
r261 r289 37 37 38 38 void * tr_memmem( const void *, size_t, const void *, size_t ); 39 40 /*********************************************************************** 41 * tr_mkdir 42 *********************************************************************** 43 * Create a directory and any needed parent directories. 44 * Note that the string passed in must be writable! 45 **********************************************************************/ 46 int tr_mkdir( char * path ); 39 47 40 48 /***********************************************************************
Note: See TracChangeset
for help on using the changeset viewer.