* Cleans up libhb at a process level. Call before the app closes. Removes preview directory. */
| 2212 | * Cleans up libhb at a process level. Call before the app closes. Removes preview directory. |
| 2213 | */ |
| 2214 | void hb_global_close() |
| 2215 | { |
| 2216 | const char * dirname; |
| 2217 | DIR * dir; |
| 2218 | struct dirent * entry; |
| 2219 | |
| 2220 | hb_presets_free(); |
| 2221 | |
| 2222 | /* Find and remove temp folder */ |
| 2223 | dirname = hb_get_temporary_directory(); |
| 2224 | |
| 2225 | dir = opendir( dirname ); |
| 2226 | if (dir) |
| 2227 | { |
| 2228 | while( ( entry = readdir( dir ) ) ) |
| 2229 | { |
| 2230 | char * filename; |
| 2231 | if( entry->d_name[0] == '.' ) |
| 2232 | { |
| 2233 | continue; |
| 2234 | } |
| 2235 | filename = hb_strdup_printf("%s/%s", dirname, entry->d_name); |
| 2236 | unlink( filename ); |
| 2237 | free(filename); |
| 2238 | } |
| 2239 | closedir( dir ); |
| 2240 | rmdir( dirname ); |
| 2241 | } |
| 2242 | } |
| 2243 | |
| 2244 | /** |
| 2245 | * Monitors the state of the update, scan, and work threads. |