FreeBSD/contrib/subversion/subversion/libsvn_wc/wc_db_pristine.c
/* Remove the file at FILE_ABSPATH in such a way that we could re-create a
 * new file of the same name at any time thereafter.
 *
 * On Windows, the file will not disappear immediately from the directory if
 * it is still being read so the best thing to do is first rename it to a
 * unique name. */
Remove the file at FILE_ABSPATH in such a way that we could re-create a
new file of the same name at any time thereafter.

On Windows, the file will not disappear immediately from the directory if
it is still being read so the best thing to do is first rename it to a
unique name.
Remove the file at FILE_ABSPATH in such a way that we could re - create a new file of the same name at any time thereafter . On Windows the file will not disappear immediately from the directory if it is still being read so the best thing to do is first rename it to a unique name .
static svn_error_t *
remove_file(const char *file_abspath,
            svn_wc__db_wcroot_t *wcroot,
            svn_boolean_t ignore_enoent,
            apr_pool_t *scratch_pool)
{
#ifdef WIN32
  svn_error_t *err;
  const char *temp_abspath;
  const char *temp_dir_abspath
    = pristine_get_tempdir(wcroot, scratch_pool, scratch_pool);
  SVN_ERR(svn_io_open_unique_file3(NULL, &temp_abspath, temp_dir_abspath,
                                   svn_io_file_del_none,
                                   scratch_pool, scratch_pool));
  err = svn_io_file_rename(file_abspath, temp_abspath, scratch_pool);
  if (err && ignore_enoent && APR_STATUS_IS_ENOENT(err->apr_err))
    svn_error_clear(err);
  else
    SVN_ERR(err);
  file_abspath = temp_abspath;
#endif
  SVN_ERR(svn_io_remove_file2(file_abspath, ignore_enoent, scratch_pool));
  return SVN_NO_ERROR;
}
static svn_error_t * remove_file ( const char * file_abspath , svn_wc__db_wcroot_t * wcroot , svn_boolean_t ignore_enoent , apr_pool_t * scratch_pool ) { #ifdef WIN32 svn_error_t * err ; const char * temp_abspath ; const char * temp_dir_abspath = pristine_get_tempdir ( wcroot , scratch_pool , scratch_pool ) ; SVN_ERR ( svn_io_open_unique_file3 ( NULL , & temp_abspath , temp_dir_abspath , svn_io_file_del_none , scratch_pool , scratch_pool ) ) ; err = svn_io_file_rename ( file_abspath , temp_abspath , scratch_pool ) ; if ( err && ignore_enoent && APR_STATUS_IS_ENOENT ( err -> apr_err ) ) svn_error_clear ( err ) ; else SVN_ERR ( err ) ; file_abspath = temp_abspath ; #endif SVN_ERR ( svn_io_remove_file2 ( file_abspath , ignore_enoent , scratch_pool ) ) ; return SVN_NO_ERROR ; }
Remove the file at FILE_ABSPATH in such a way that we could re-create a
 new file of the same name at any time thereafter.
Remove the file at FILE_ABSPATH in such a way that we could re - create a new file of the same name at any time thereafter .
/* To rename the file to a unique name in the temp dir, first create a
   * uniquely named file in the temp dir and then overwrite it. */