stop dzsave early if the output dir exists

see https://github.com/jcupitt/libvips/issues/312
This commit is contained in:
John Cupitt 2015-07-08 14:25:14 +01:00
parent b3d35da677
commit fa8d1d2342
1 changed files with 13 additions and 1 deletions

View File

@ -1636,6 +1636,18 @@ vips_foreign_save_dz_build( VipsObject *object )
dz->file_suffix = g_strdup( filename );
}
/* If we will be renaming our temp dir to an existing directory or
* file, stop now. See vips_rename() use below.
*/
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ &&
dz->container == VIPS_FOREIGN_DZ_CONTAINER_FS &&
vips_existsf( "%s/%s_files", dz->dirname, dz->basename ) ) {
vips_error( "dzsave",
_( "output directory %s/%s_files exists" ),
dz->dirname, dz->basename );
return( -1 );
}
/* Make the thing we write the tiles into.
*/
switch( dz->container ) {