copy the file permissions also.

2004-10-31  Sven Neumann  <sven@gimp.org>

	* app/config/gimpconfig-utils.c (gimp_config_file_copy): copy the
	file permissions also.

	* app/dialogs/user-install-dialog.c: added code to migrate user
	settings from ~/.gimp-2.0. It copies all files (except GIMP swap
	files) and all subdirectories (except tmp) with all files. It
	doesn't recurse into subdirectories.
This commit is contained in:
Sven Neumann 2004-10-31 17:51:00 +00:00 committed by Sven Neumann
parent 4a378440bb
commit bd3a5ed2c0
4 changed files with 197 additions and 22 deletions

View file

@ -24,11 +24,17 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <glib-object.h>
#include "libgimpbase/gimpbase.h"
#ifdef G_OS_WIN32
#include "libgimpbase/gimpwin32-io.h"
#endif
#include "config-types.h"
#include "gimpconfig.h"
@ -533,9 +539,11 @@ gimp_config_file_copy (const gchar *source,
const gchar *dest,
GError **error)
{
gchar buffer[4096];
FILE *sfile, *dfile;
gint nbytes;
gchar buffer[8192];
FILE *sfile;
FILE *dfile;
struct stat stat_buf;
gint nbytes;
sfile = fopen (source, "rb");
if (sfile == NULL)
@ -589,6 +597,11 @@ gimp_config_file_copy (const gchar *source,
return FALSE;
}
if (stat (source, &stat_buf) == 0)
{
chmod (dest, stat_buf.st_mode);
}
return TRUE;
}