mirror of https://github.com/GNOME/gimp.git
app/app_procs.c app/base/temp-buf.c app/core/gimpmodules.c
2002-02-18 Sven Neumann <sven@gimp.org> * app/app_procs.c * app/base/temp-buf.c * app/core/gimpmodules.c * app/plug-in/plug-in.c * libgimpbase/gimpenv.c * libgimpwidgets/gimpfileselection.c * plug-ins/FractalExplorer/Dialogs.c * plug-ins/FractalExplorer/FractalExplorer.c * plug-ins/flame/flame.c * plug-ins/gfig/gfig.c * plug-ins/gflare/gflare.c * plug-ins/gimpressionist/gimpressionist.[ch]: use g_file_test() instead of stat() whereever possible. Improves code readability.
This commit is contained in:
parent
fb8c94c0a4
commit
fe2c9e8bbf
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
|||
2002-02-18 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/app_procs.c
|
||||
* app/base/temp-buf.c
|
||||
* app/core/gimpmodules.c
|
||||
* app/plug-in/plug-in.c
|
||||
* libgimpbase/gimpenv.c
|
||||
* libgimpwidgets/gimpfileselection.c
|
||||
* plug-ins/FractalExplorer/Dialogs.c
|
||||
* plug-ins/FractalExplorer/FractalExplorer.c
|
||||
* plug-ins/flame/flame.c
|
||||
* plug-ins/gfig/gfig.c
|
||||
* plug-ins/gflare/gflare.c
|
||||
* plug-ins/gimpressionist/gimpressionist.[ch]: use g_file_test()
|
||||
instead of stat() whereever possible. Improves code readability.
|
||||
|
||||
2002-02-18 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* configure.in: require latest glib and gtk+ releases (1.3.14).
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -21,11 +21,11 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -83,7 +83,6 @@ app_init (gint gimp_argc,
|
|||
gchar **gimp_argv)
|
||||
{
|
||||
const gchar *gimp_dir;
|
||||
struct stat stat_buf;
|
||||
|
||||
/* Create an instance of the "Gimp" object which is the root of the
|
||||
* core object system
|
||||
|
@ -99,7 +98,7 @@ app_init (gint gimp_argc,
|
|||
*/
|
||||
gimp_dir = gimp_directory ();
|
||||
|
||||
if (stat (gimp_dir, &stat_buf) != 0)
|
||||
if (!g_file_test (gimp_dir, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
/* not properly installed */
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
@ -622,11 +620,9 @@ generate_unique_filename (void)
|
|||
void
|
||||
temp_buf_swap (TempBuf *buf)
|
||||
{
|
||||
TempBuf *swap;
|
||||
gchar *filename;
|
||||
struct stat stat_buf;
|
||||
gint err;
|
||||
FILE *fp;
|
||||
TempBuf *swap;
|
||||
gchar *filename;
|
||||
FILE *fp;
|
||||
|
||||
if (!buf || buf->swapped)
|
||||
return;
|
||||
|
@ -654,15 +650,11 @@ temp_buf_swap (TempBuf *buf)
|
|||
filename = generate_unique_filename ();
|
||||
|
||||
/* Check if generated filename is valid */
|
||||
err = stat (filename, &stat_buf);
|
||||
if (!err)
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
if (stat_buf.st_mode & S_IFDIR)
|
||||
{
|
||||
g_message ("Error in temp buf caching: \"%s\" is a directory (cannot overwrite)", filename);
|
||||
g_free (filename);
|
||||
return;
|
||||
}
|
||||
g_message ("Error in temp buf caching: \"%s\" is a directory (cannot overwrite)", filename);
|
||||
g_free (filename);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Open file for overwrite */
|
||||
|
@ -698,9 +690,8 @@ temp_buf_swap (TempBuf *buf)
|
|||
void
|
||||
temp_buf_unswap (TempBuf *buf)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
FILE *fp;
|
||||
gboolean succ = FALSE;
|
||||
FILE *fp;
|
||||
gboolean succ = FALSE;
|
||||
|
||||
if (!buf || !buf->swapped)
|
||||
return;
|
||||
|
@ -718,9 +709,7 @@ temp_buf_unswap (TempBuf *buf)
|
|||
/* Allocate memory for the buffer's data */
|
||||
buf->data = temp_buf_allocate (buf->width * buf->height * buf->bytes);
|
||||
|
||||
/* Find out if the filename of the swapped data is an existing file... */
|
||||
/* (buf->filname HAS to be != 0 */
|
||||
if (!stat (buf->filename, &stat_buf))
|
||||
if (g_file_test (buf->filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
if ((fp = fopen (buf->filename, "rb")))
|
||||
{
|
||||
|
@ -748,8 +737,6 @@ temp_buf_unswap (TempBuf *buf)
|
|||
void
|
||||
temp_buf_swap_free (TempBuf *buf)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
|
||||
if (!buf->swapped)
|
||||
return;
|
||||
|
||||
|
@ -764,7 +751,7 @@ temp_buf_swap_free (TempBuf *buf)
|
|||
}
|
||||
|
||||
/* Find out if the filename of the swapped data is an existing file... */
|
||||
if (!stat (buf->filename, &stat_buf))
|
||||
if (g_file_test (buf->filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
/* Delete the swap file */
|
||||
unlink (buf->filename);
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -359,19 +358,14 @@ gimp_modules_module_on_disk_func (gpointer data,
|
|||
GimpModuleInfoObj *module_info;
|
||||
GList **kill_list;
|
||||
gint old_on_disk;
|
||||
struct stat statbuf;
|
||||
gint ret;
|
||||
|
||||
module_info = (GimpModuleInfoObj *) data;
|
||||
kill_list = (GList **) user_data;
|
||||
|
||||
old_on_disk = module_info->on_disk;
|
||||
|
||||
ret = stat (module_info->fullpath, &statbuf);
|
||||
if (ret != 0)
|
||||
module_info->on_disk = FALSE;
|
||||
else
|
||||
module_info->on_disk = TRUE;
|
||||
module_info->on_disk = g_file_test (module_info->fullpath,
|
||||
G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||
* removed later.
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -359,19 +358,14 @@ gimp_modules_module_on_disk_func (gpointer data,
|
|||
GimpModuleInfoObj *module_info;
|
||||
GList **kill_list;
|
||||
gint old_on_disk;
|
||||
struct stat statbuf;
|
||||
gint ret;
|
||||
|
||||
module_info = (GimpModuleInfoObj *) data;
|
||||
kill_list = (GList **) user_data;
|
||||
|
||||
old_on_disk = module_info->on_disk;
|
||||
|
||||
ret = stat (module_info->fullpath, &statbuf);
|
||||
if (ret != 0)
|
||||
module_info->on_disk = FALSE;
|
||||
else
|
||||
module_info->on_disk = TRUE;
|
||||
module_info->on_disk = g_file_test (module_info->fullpath,
|
||||
G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||
* removed later.
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -33,8 +33,7 @@
|
|||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <time.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
|
@ -3517,12 +3516,10 @@ static gchar *
|
|||
plug_in_search_in_path (gchar *search_path,
|
||||
gchar *filename)
|
||||
{
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
struct stat buf;
|
||||
gint err;
|
||||
gchar *local_path;
|
||||
gchar *token;
|
||||
gchar *next_token;
|
||||
gchar *path;
|
||||
|
||||
local_path = g_strdup (search_path);
|
||||
next_token = local_path;
|
||||
|
@ -3532,8 +3529,7 @@ plug_in_search_in_path (gchar *search_path,
|
|||
{
|
||||
path = g_build_filename (token, filename, NULL);
|
||||
|
||||
err = stat (path, &buf);
|
||||
if (!err && S_ISREG (buf.st_mode))
|
||||
if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
token = path;
|
||||
break;
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -287,9 +289,7 @@ gimp_path_parse (const gchar *path,
|
|||
GList *list = NULL;
|
||||
GList *fail_list = NULL;
|
||||
gint i;
|
||||
|
||||
struct stat filestat;
|
||||
gint err = FALSE;
|
||||
gboolean exists = TRUE;
|
||||
|
||||
if (!path || !*path || max_paths < 1 || max_paths > 256)
|
||||
return NULL;
|
||||
|
@ -321,11 +321,10 @@ gimp_path_parse (const gchar *path,
|
|||
_fnslashify (dir);
|
||||
#endif
|
||||
|
||||
/* check if directory exists */
|
||||
if (check)
|
||||
err = stat (dir->str, &filestat);
|
||||
exists = g_file_test (dir->str, G_FILE_TEST_IS_DIR);
|
||||
|
||||
if (!err)
|
||||
if (exists)
|
||||
list = g_list_prepend (list, g_strdup (dir->str));
|
||||
else if (check_failed)
|
||||
fail_list = g_list_prepend (fail_list, g_strdup (dir->str));
|
||||
|
|
|
@ -23,8 +23,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -359,19 +358,14 @@ gimp_modules_module_on_disk_func (gpointer data,
|
|||
GimpModuleInfoObj *module_info;
|
||||
GList **kill_list;
|
||||
gint old_on_disk;
|
||||
struct stat statbuf;
|
||||
gint ret;
|
||||
|
||||
module_info = (GimpModuleInfoObj *) data;
|
||||
kill_list = (GList **) user_data;
|
||||
|
||||
old_on_disk = module_info->on_disk;
|
||||
|
||||
ret = stat (module_info->fullpath, &statbuf);
|
||||
if (ret != 0)
|
||||
module_info->on_disk = FALSE;
|
||||
else
|
||||
module_info->on_disk = TRUE;
|
||||
module_info->on_disk = g_file_test (module_info->fullpath,
|
||||
G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
/* if it's not on the disk, and it isn't in memory, mark it to be
|
||||
* removed later.
|
||||
|
|
|
@ -411,8 +411,8 @@ gimp_file_selection_browse_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
||||
{
|
||||
static struct stat statbuf;
|
||||
gchar *filename;
|
||||
gchar *filename;
|
||||
gboolean exists;
|
||||
|
||||
if (! gfs->check_valid)
|
||||
return;
|
||||
|
@ -422,17 +422,14 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
|||
|
||||
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||
|
||||
if ((stat (filename, &statbuf) == 0) &&
|
||||
(gfs->dir_only ? S_ISDIR (statbuf.st_mode) : S_ISREG (statbuf.st_mode)))
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
GTK_STOCK_YES, GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
if (gfs->dir_only)
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_DIR);
|
||||
else
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
GTK_STOCK_NO, GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
exists ? GTK_STOCK_YES : GTK_STOCK_NO,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
|
|
|
@ -411,8 +411,8 @@ gimp_file_selection_browse_callback (GtkWidget *widget,
|
|||
static void
|
||||
gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
||||
{
|
||||
static struct stat statbuf;
|
||||
gchar *filename;
|
||||
gchar *filename;
|
||||
gboolean exists;
|
||||
|
||||
if (! gfs->check_valid)
|
||||
return;
|
||||
|
@ -422,17 +422,14 @@ gimp_file_selection_check_filename (GimpFileSelection *gfs)
|
|||
|
||||
filename = gtk_editable_get_chars (GTK_EDITABLE (gfs->entry), 0, -1);
|
||||
|
||||
if ((stat (filename, &statbuf) == 0) &&
|
||||
(gfs->dir_only ? S_ISDIR (statbuf.st_mode) : S_ISREG (statbuf.st_mode)))
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
GTK_STOCK_YES, GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
if (gfs->dir_only)
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_DIR);
|
||||
else
|
||||
{
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
GTK_STOCK_NO, GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);
|
||||
|
||||
g_free (filename);
|
||||
|
||||
gtk_image_set_from_stock (GTK_IMAGE (gfs->file_exists),
|
||||
exists ? GTK_STOCK_YES : GTK_STOCK_NO,
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
|
@ -1612,8 +1610,6 @@ file_selection_ok (GtkWidget *w,
|
|||
gpointer data)
|
||||
{
|
||||
const gchar *filenamebuf;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
|
||||
filenamebuf = gtk_file_selection_get_filename (GTK_FILE_SELECTION(fs));
|
||||
|
||||
|
@ -1624,10 +1620,7 @@ file_selection_ok (GtkWidget *w,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Check if directory exists */
|
||||
err = stat (filenamebuf, &filestat);
|
||||
|
||||
if (!err && S_ISDIR (filestat.st_mode))
|
||||
if (g_file_test (filenamebuf, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
/* Can't save to directory */
|
||||
g_message (_("Save: Can't save to a folder."));
|
||||
|
@ -1648,14 +1641,10 @@ load_file_selection_ok (GtkWidget *w,
|
|||
GtkFileSelection *fs,
|
||||
gpointer data)
|
||||
{
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
filename =
|
||||
g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
|
||||
filename = g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
|
||||
err = stat (filename, &filestat);
|
||||
|
||||
if (!err && S_ISREG (filestat.st_mode))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
explorer_load ();
|
||||
}
|
||||
|
|
|
@ -54,12 +54,9 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
|
@ -151,13 +148,13 @@ static void build_list_items (GtkWidget *list);
|
|||
static void fractalexplorer_free (fractalexplorerOBJ *feOBJ);
|
||||
static void fractalexplorer_free_everything (fractalexplorerOBJ *feOBJ);
|
||||
static void fractalexplorer_list_free_all (void);
|
||||
static fractalexplorerOBJ * fractalexplorer_load (gchar *filename,
|
||||
gchar *name);
|
||||
static fractalexplorerOBJ * fractalexplorer_load (const gchar *filename,
|
||||
const gchar *name);
|
||||
|
||||
static void fractalexplorer_list_load_all (GList *plist);
|
||||
static void fractalexplorer_rescan_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void fractalexplorer_rescan_list (void);
|
||||
static void fractalexplorer_list_load_all (GList *plist);
|
||||
static void fractalexplorer_rescan_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void fractalexplorer_rescan_list (void);
|
||||
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
|
@ -1228,8 +1225,8 @@ fractalexplorer_list_free_all (void)
|
|||
}
|
||||
|
||||
fractalexplorerOBJ *
|
||||
fractalexplorer_load (gchar *filename,
|
||||
gchar *name)
|
||||
fractalexplorer_load (const gchar *filename,
|
||||
const gchar *name)
|
||||
{
|
||||
fractalexplorerOBJ * fractalexplorer;
|
||||
FILE * fp;
|
||||
|
@ -1292,8 +1289,6 @@ fractalexplorer_list_load_all (GList *plist)
|
|||
gchar *filename;
|
||||
GDir *dir;
|
||||
const gchar *dir_ent;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
|
||||
/* Make sure to clear any existing fractalexplorers */
|
||||
current_obj = pic_obj = NULL;
|
||||
|
@ -1317,18 +1312,14 @@ fractalexplorer_list_load_all (GList *plist)
|
|||
{
|
||||
filename = g_build_filename (path, dir_ent, NULL);
|
||||
|
||||
/* Check the file and see that it is not a sub-directory */
|
||||
err = stat (filename, &filestat);
|
||||
|
||||
if (!err && S_ISREG (filestat.st_mode))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
|
||||
fractalexplorer = fractalexplorer_load (filename, dir_ent);
|
||||
|
||||
if (fractalexplorer)
|
||||
{
|
||||
/* Read only ?*/
|
||||
if(access(filename,W_OK))
|
||||
if (access (filename, W_OK))
|
||||
fractalexplorer->obj_status |= fractalexplorer_READONLY;
|
||||
|
||||
fractalexplorer_list_insert (fractalexplorer);
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
@ -409,7 +409,6 @@ file_ok_callback (GtkWidget *widget,
|
|||
{
|
||||
GtkFileSelection *fs;
|
||||
const gchar *filename;
|
||||
struct stat filestat;
|
||||
|
||||
fs = GTK_FILE_SELECTION (data);
|
||||
filename = gtk_file_selection_get_filename (fs);
|
||||
|
@ -420,15 +419,9 @@ file_ok_callback (GtkWidget *widget,
|
|||
gint i, c;
|
||||
gchar *ss;
|
||||
|
||||
if (stat (filename, &filestat))
|
||||
if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
g_message ("%s: %s", filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
if (! S_ISREG (filestat.st_mode))
|
||||
{
|
||||
g_message (_("%s: Is not a regular file"), filename);
|
||||
g_message (_("'%s' is not a regular file"), filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -436,7 +429,7 @@ file_ok_callback (GtkWidget *widget,
|
|||
|
||||
if (f == NULL)
|
||||
{
|
||||
g_message ("%s: %s", filename, g_strerror (errno));
|
||||
g_message (_("Can't open '%s': %s"), filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,12 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning GTK_DISABLE_DEPRECATED
|
||||
|
@ -865,7 +864,7 @@ gfig_name_encode (gchar *dest,
|
|||
|
||||
while (*src && cnt--)
|
||||
{
|
||||
if (iscntrl (*src) || isspace (*src) || *src == '\\')
|
||||
if (g_ascii_iscntrl (*src) || g_ascii_isspace (*src) || *src == '\\')
|
||||
{
|
||||
sprintf (dest, "\\%03o", *src++);
|
||||
dest += 4;
|
||||
|
@ -1006,8 +1005,6 @@ gfig_list_load_all (GList *plist)
|
|||
gchar *filename;
|
||||
GDir *dir;
|
||||
const gchar *dir_ent;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
|
||||
/* Make sure to clear any existing gfigs */
|
||||
current_obj = pic_obj = NULL;
|
||||
|
@ -1031,9 +1028,7 @@ gfig_list_load_all (GList *plist)
|
|||
filename = g_build_filename (path, dir_ent, NULL);
|
||||
|
||||
/* Check the file and see that it is not a sub-directory */
|
||||
err = stat (filename, &filestat);
|
||||
|
||||
if (!err && S_ISREG (filestat.st_mode))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
gfig = gfig_load (filename, dir_ent);
|
||||
|
||||
|
@ -1517,8 +1512,6 @@ file_selection_ok (GtkWidget *w,
|
|||
gpointer data)
|
||||
{
|
||||
const gchar *filenamebuf;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
GFigObj *obj = (GFigObj *)gtk_object_get_user_data (GTK_OBJECT (fs));
|
||||
GFigObj *real_current;
|
||||
|
||||
|
@ -1534,10 +1527,7 @@ file_selection_ok (GtkWidget *w,
|
|||
return;
|
||||
}
|
||||
|
||||
/* Check if directory exists */
|
||||
err = stat (filenamebuf, &filestat);
|
||||
|
||||
if (!err && S_ISDIR (filestat.st_mode))
|
||||
if (g_file_test (filenamebuf, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
g_message ("Save: Can't save to a folder.");
|
||||
return;
|
||||
|
@ -4570,8 +4560,6 @@ gfig_load_file_selection_ok (GtkWidget *widget,
|
|||
gpointer data)
|
||||
{
|
||||
const gchar *filename;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
GFigObj *gfig;
|
||||
GFigObj *current_saved;
|
||||
|
||||
|
@ -4581,9 +4569,7 @@ gfig_load_file_selection_ok (GtkWidget *widget,
|
|||
printf ("Loading file '%s'\n", filename);
|
||||
#endif /* DEBUG */
|
||||
|
||||
err = stat (filename, &filestat);
|
||||
|
||||
if (!err && S_ISREG (filestat.st_mode))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
/* Hack - current object MUST be NULL to prevent setup_undo ()
|
||||
* from kicking in.
|
||||
|
|
|
@ -1806,8 +1806,6 @@ gflares_list_load_all (void)
|
|||
gchar *filename;
|
||||
GDir *dir;
|
||||
const gchar *dir_ent;
|
||||
struct stat filestat;
|
||||
gint err;
|
||||
|
||||
#if 0 /* @@@ */
|
||||
printf("Waiting... (pid %d)\n", getpid());
|
||||
|
@ -1835,9 +1833,7 @@ gflares_list_load_all (void)
|
|||
filename = g_build_filename (path, dir_ent, NULL);
|
||||
|
||||
/* Check the file and see that it is not a sub-directory */
|
||||
err = stat (filename, &filestat);
|
||||
|
||||
if (!err && S_ISREG (filestat.st_mode))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
{
|
||||
gflare = gflare_load (filename, dir_ent);
|
||||
if (gflare)
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -45,7 +43,6 @@ GList * parsepath (void)
|
|||
{
|
||||
static GList *lastpath = NULL;
|
||||
gchar *gimpdatasubdir, *defaultpath, *tmps;
|
||||
struct stat st;
|
||||
|
||||
if (lastpath)
|
||||
return lastpath;
|
||||
|
@ -66,18 +63,25 @@ GList * parsepath (void)
|
|||
|
||||
if (!tmps)
|
||||
{
|
||||
if (stat (gimpdatasubdir, &st) != 0
|
||||
|| !S_ISDIR(st.st_mode))
|
||||
if (!g_file_test (gimpdatasubdir, G_FILE_TEST_IS_DIR))
|
||||
{
|
||||
/* No gimpressionist-path parameter,
|
||||
* and the default doesn't exist */
|
||||
g_message( "*** Warning ***\n"
|
||||
"It is highly recommended to add\n"
|
||||
" (gimpressionist-path \"${gimp_dir}" G_DIR_SEPARATOR_S "gimpressionist"
|
||||
G_SEARCHPATH_SEPARATOR_S
|
||||
"${gimp_data_dir}" G_DIR_SEPARATOR_S "gimpressionist\")\n"
|
||||
"(or similar) to your gimprc file.\n");
|
||||
}
|
||||
and the default doesn't exist */
|
||||
gchar *path = g_strconcat ("${gimp_dir}",
|
||||
G_DIR_SEPARATOR_S,
|
||||
"gimpressionist",
|
||||
G_SEARCHPATH_SEPARATOR_S,
|
||||
"${gimp_data_dir}",
|
||||
G_DIR_SEPARATOR_S,
|
||||
"gimpressionist",
|
||||
NULL);
|
||||
|
||||
/* don't translate the gimprc entry */
|
||||
g_message (_("It is highly recommended to add\n"
|
||||
" (gimpressionist-path \"%s\")\n"
|
||||
"(or similar) to your gimprc file."), path);
|
||||
g_free (path);
|
||||
}
|
||||
tmps = g_strdup (defaultpath);
|
||||
}
|
||||
}
|
||||
|
@ -89,21 +93,22 @@ GList * parsepath (void)
|
|||
return lastpath;
|
||||
}
|
||||
|
||||
gchar *findfile(char *fn)
|
||||
gchar *
|
||||
findfile (const gchar *fn)
|
||||
{
|
||||
static GList *rcpath = NULL;
|
||||
GList *thispath;
|
||||
gchar *filename;
|
||||
struct stat st;
|
||||
|
||||
if(!rcpath) rcpath = parsepath ();
|
||||
if (!rcpath)
|
||||
rcpath = parsepath ();
|
||||
|
||||
thispath = rcpath;
|
||||
|
||||
while (rcpath && thispath)
|
||||
{
|
||||
filename = g_build_filename (thispath->data, fn, NULL);
|
||||
if(!stat(filename, &st))
|
||||
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
|
||||
return filename;
|
||||
g_free (filename);
|
||||
thispath = thispath->next;
|
||||
|
@ -254,9 +259,8 @@ void reselect(GtkWidget *list, char *fname)
|
|||
|
||||
void readdirintolist_real(char *subdir, GtkWidget *list, char *selected)
|
||||
{
|
||||
char *fpath;
|
||||
gchar *fpath;
|
||||
const gchar *de;
|
||||
struct stat st;
|
||||
GtkWidget *selectedw = NULL, *tmpw;
|
||||
GDir *dir;
|
||||
GList *flist = NULL;
|
||||
|
@ -271,19 +275,28 @@ void readdirintolist_real(char *subdir, GtkWidget *list, char *selected)
|
|||
}
|
||||
}
|
||||
|
||||
dir = g_dir_open(subdir, 0, NULL);
|
||||
dir = g_dir_open (subdir, 0, NULL);
|
||||
|
||||
if(!dir)
|
||||
if (!dir)
|
||||
return;
|
||||
|
||||
for(;;) {
|
||||
if(!(de = g_dir_read_name(dir))) break;
|
||||
fpath = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", subdir, de);
|
||||
stat(fpath, &st);
|
||||
g_free(fpath);
|
||||
if(!S_ISREG(st.st_mode)) continue;
|
||||
flist = g_list_insert_sorted(flist, g_strdup(de), (GCompareFunc)g_ascii_strcasecmp);
|
||||
}
|
||||
for(;;)
|
||||
{
|
||||
gboolean file_exists;
|
||||
|
||||
de = g_dir_read_name (dir);
|
||||
if (!de)
|
||||
break;
|
||||
|
||||
fpath = g_build_filename (subdir, de, NULL);
|
||||
file_exists = g_file_test (fpath, G_FILE_TEST_IS_REGULAR);
|
||||
g_free (fpath);
|
||||
|
||||
if (!file_exists)
|
||||
continue;
|
||||
|
||||
flist = g_list_insert_sorted(flist, g_strdup(de), (GCompareFunc)g_ascii_strcasecmp);
|
||||
}
|
||||
g_dir_close(dir);
|
||||
|
||||
while(flist) {
|
||||
|
@ -307,12 +320,13 @@ void readdirintolist(char *subdir, GtkWidget *list, char *selected)
|
|||
char *tmpdir;
|
||||
GList *thispath = parsepath();
|
||||
|
||||
while(thispath) {
|
||||
tmpdir = g_strdup_printf("%s" G_DIR_SEPARATOR_S "%s", (char *)thispath->data, subdir);
|
||||
readdirintolist_real(tmpdir, list, selected);
|
||||
g_free(tmpdir);
|
||||
thispath = thispath->next;
|
||||
}
|
||||
while(thispath)
|
||||
{
|
||||
tmpdir = g_build_filename ((gchar *) thispath->data, subdir, NULL);
|
||||
readdirintolist_real (tmpdir, list, selected);
|
||||
g_free (tmpdir);
|
||||
thispath = thispath->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ void updatepreviewprev(GtkWidget *wg, void *d);
|
|||
void grabarea(void);
|
||||
void storevals(void);
|
||||
void restorevals(void);
|
||||
char *findfile(char *);
|
||||
gchar *findfile(const gchar *);
|
||||
|
||||
void unselectall(GtkWidget *list);
|
||||
void reselect(GtkWidget *list, char *fname);
|
||||
|
|
Loading…
Reference in New Issue