1999-03-07 20:56:03 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
*
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
* Copyright (C) 1999 Tor Lillqvist
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
Regarding the GPL => LGPL change:
-----------------------------------------------------------------------------
Hi. The following files in libgimp/ state that they are GPL'ed, rather than
LGPL'ed:
gimpenv.c
color_selector.h
color_display.h
I looked through the cvs logs of these files and found these "authors"
(the files may be older, but it's all I got):
* Manish Singh <yosh@gimp.org>
* ape@spacetec.no (Asbjorn Pettersen)
* Tor Lillqvist <tml@iki.fi>
* Austin Donnelly <austin@gimp.org>
* Michael Natterer <mitch@gimp.org>
petm@xcf.berkeley.edu
spencer@xcf.berkeley.edu
I'd like to change the notice to LGPL again. If all of you agree with this
(just reply with a "yes") then I will just do this and paste your replies
into the log file.
-----------------------------------------------------------------------------
Date: Wed, 17 Nov 1999 23:30:27 +0200 (EET)
From: Tor Lillqvist <tml@sgic.fi>
Message-Id: <199911172130.XAA18357@platon.sgic.fi>
> I'd like to change the notice to LGPL again. If all of you agree with this
> (just reply with a "yes") then I will just do this and paste your replies
> into the log file.
YES!
--tml
-----------------------------------------------------------------------------
Date: Wed, 17 Nov 1999 13:31:45 -0800
From: Manish Singh <yosh@gimp.org>
Message-ID: <19991117133145.A7895@wilber.gimp.org>
On Wed, Nov 17, 1999 at 10:26:25PM +0100, Marc Lehmann wrote:
> Hi. The following files in libgimp/ state that they are GPL'ed, rather than
> LGPL'ed:
>
> gimpenv.c
Needs S&P approval too.
(yes for me)
-----------------------------------------------------------------------------
Message-ID: <3833B9B6.6AD4B80A@cs.tu-berlin.de>
Date: Thu, 18 Nov 1999 09:32:54 +0100
From: Michael Natterer <mitschel@cs.tu-berlin.de>
> I'd like to change the notice to LGPL again. If all of you agree with this
> (just reply with a "yes") then I will just do this and paste your replies
> into the log file.
Yes ;-) (go for it please...)
--Mitch
-----------------------------------------------------------------------------
Message-Id: <199911180815.JAA17782@spacetec.no>
From: "Asbjoern Pettersen" <ape@spacetec.no>
Date: Thu, 18 Nov 99 09:15:14
OK for me. (asbjorn)
>> Tor Lillqvist <tml@iki.fi>
>> Austin Donnelly <austin@gimp.org>
>> Michael Natterer <mitch@gimp.org>
>>
>> I'd like to change the notice to LGPL again. If all of you agree with this
>> (just reply with a "yes") then I will just do this and paste your replies
>> into the log file.
-----------------------------------------------------------------------------
Message-ID: <14387.56381.340662.797845@bailey.cl.cam.ac.uk>
From: Austin Donnelly <Austin.Donnelly@cl.cam.ac.uk>
Date: Thu, 18 Nov 1999 11:00:13 +0000 (GMT)
[...]
Yes, I don't mind them going under LGPL.
Austin
2000-01-16 05:30:17 +08:00
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
1999-03-07 20:56:03 +08:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
Regarding the GPL => LGPL change:
-----------------------------------------------------------------------------
Hi. The following files in libgimp/ state that they are GPL'ed, rather than
LGPL'ed:
gimpenv.c
color_selector.h
color_display.h
I looked through the cvs logs of these files and found these "authors"
(the files may be older, but it's all I got):
* Manish Singh <yosh@gimp.org>
* ape@spacetec.no (Asbjorn Pettersen)
* Tor Lillqvist <tml@iki.fi>
* Austin Donnelly <austin@gimp.org>
* Michael Natterer <mitch@gimp.org>
petm@xcf.berkeley.edu
spencer@xcf.berkeley.edu
I'd like to change the notice to LGPL again. If all of you agree with this
(just reply with a "yes") then I will just do this and paste your replies
into the log file.
-----------------------------------------------------------------------------
Date: Wed, 17 Nov 1999 23:30:27 +0200 (EET)
From: Tor Lillqvist <tml@sgic.fi>
Message-Id: <199911172130.XAA18357@platon.sgic.fi>
> I'd like to change the notice to LGPL again. If all of you agree with this
> (just reply with a "yes") then I will just do this and paste your replies
> into the log file.
YES!
--tml
-----------------------------------------------------------------------------
Date: Wed, 17 Nov 1999 13:31:45 -0800
From: Manish Singh <yosh@gimp.org>
Message-ID: <19991117133145.A7895@wilber.gimp.org>
On Wed, Nov 17, 1999 at 10:26:25PM +0100, Marc Lehmann wrote:
> Hi. The following files in libgimp/ state that they are GPL'ed, rather than
> LGPL'ed:
>
> gimpenv.c
Needs S&P approval too.
(yes for me)
-----------------------------------------------------------------------------
Message-ID: <3833B9B6.6AD4B80A@cs.tu-berlin.de>
Date: Thu, 18 Nov 1999 09:32:54 +0100
From: Michael Natterer <mitschel@cs.tu-berlin.de>
> I'd like to change the notice to LGPL again. If all of you agree with this
> (just reply with a "yes") then I will just do this and paste your replies
> into the log file.
Yes ;-) (go for it please...)
--Mitch
-----------------------------------------------------------------------------
Message-Id: <199911180815.JAA17782@spacetec.no>
From: "Asbjoern Pettersen" <ape@spacetec.no>
Date: Thu, 18 Nov 99 09:15:14
OK for me. (asbjorn)
>> Tor Lillqvist <tml@iki.fi>
>> Austin Donnelly <austin@gimp.org>
>> Michael Natterer <mitch@gimp.org>
>>
>> I'd like to change the notice to LGPL again. If all of you agree with this
>> (just reply with a "yes") then I will just do this and paste your replies
>> into the log file.
-----------------------------------------------------------------------------
Message-ID: <14387.56381.340662.797845@bailey.cl.cam.ac.uk>
From: Austin Donnelly <Austin.Donnelly@cl.cam.ac.uk>
Date: Thu, 18 Nov 1999 11:00:13 +0000 (GMT)
[...]
Yes, I don't mind them going under LGPL.
Austin
2000-01-16 05:30:17 +08:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
1999-03-07 20:56:03 +08:00
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <glib.h>
|
1999-05-29 05:56:04 +08:00
|
|
|
#include <string.h>
|
1999-03-07 20:56:03 +08:00
|
|
|
#include "gimpenv.h"
|
|
|
|
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifdef G_OS_WIN32
|
1999-03-07 20:56:03 +08:00
|
|
|
#define STRICT
|
|
|
|
#include <windows.h> /* For GetModuleFileName */
|
|
|
|
#endif
|
|
|
|
|
1999-04-24 22:54:47 +08:00
|
|
|
#ifdef __EMX__
|
|
|
|
extern const char *__XOS2RedirRoot(const char *);
|
|
|
|
#endif
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
char *
|
|
|
|
gimp_directory ()
|
|
|
|
{
|
|
|
|
static char *gimp_dir = NULL;
|
|
|
|
char *env_gimp_dir;
|
|
|
|
char *home_dir;
|
|
|
|
|
|
|
|
if (gimp_dir != NULL)
|
|
|
|
return gimp_dir;
|
|
|
|
|
|
|
|
env_gimp_dir = g_getenv ("GIMP_DIRECTORY");
|
|
|
|
home_dir = g_get_home_dir ();
|
|
|
|
|
|
|
|
if (NULL != env_gimp_dir)
|
|
|
|
{
|
|
|
|
if (g_path_is_absolute (env_gimp_dir))
|
|
|
|
gimp_dir = g_strdup(env_gimp_dir);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (NULL != home_dir)
|
|
|
|
{
|
|
|
|
gimp_dir = g_strconcat (home_dir,
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
env_gimp_dir,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gimp_dir = g_strconcat (gimp_data_directory (),
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
env_gimp_dir,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-08-06 19:14:01 +08:00
|
|
|
#ifdef __EMX__
|
|
|
|
gimp_dir = g_strdup(__XOS2RedirRoot(GIMPDIR));
|
|
|
|
return gimp_dir;
|
|
|
|
#endif
|
|
|
|
if (NULL != home_dir)
|
1999-03-07 20:56:03 +08:00
|
|
|
{
|
|
|
|
gimp_dir = g_strconcat (home_dir, G_DIR_SEPARATOR_S,
|
|
|
|
GIMPDIR, NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
1999-11-23 06:38:02 +08:00
|
|
|
g_message ("warning: no home directory.");
|
1999-07-15 00:02:32 +08:00
|
|
|
#endif
|
1999-03-07 20:56:03 +08:00
|
|
|
gimp_dir = g_strconcat (gimp_data_directory (),
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
GIMPDIR,
|
|
|
|
".",
|
|
|
|
g_get_user_name (),
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return gimp_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
gimp_personal_rc_file (char *basename)
|
|
|
|
{
|
|
|
|
return g_strconcat (gimp_directory (),
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
basename,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
char *
|
|
|
|
gimp_data_directory ()
|
|
|
|
{
|
|
|
|
static char *gimp_data_dir = NULL;
|
|
|
|
char *env_gimp_data_dir = NULL;
|
|
|
|
|
|
|
|
if (gimp_data_dir != NULL)
|
|
|
|
return gimp_data_dir;
|
|
|
|
|
|
|
|
env_gimp_data_dir = g_getenv ("GIMP_DATADIR");
|
|
|
|
|
|
|
|
if (NULL != env_gimp_data_dir)
|
|
|
|
{
|
|
|
|
if (!g_path_is_absolute (env_gimp_data_dir))
|
|
|
|
g_error ("GIMP_DATADIR environment variable should be an absolute path.");
|
1999-07-29 03:36:04 +08:00
|
|
|
#ifndef __EMX__
|
1999-03-07 20:56:03 +08:00
|
|
|
gimp_data_dir = g_strdup (env_gimp_data_dir);
|
1999-07-29 03:36:04 +08:00
|
|
|
#else
|
|
|
|
gimp_data_dir = g_strdup (__XOS2RedirRoot(env_gimp_data_dir));
|
|
|
|
#endif
|
1999-03-07 20:56:03 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-10-05 03:26:07 +08:00
|
|
|
#ifndef G_OS_WIN32
|
1999-04-24 22:54:47 +08:00
|
|
|
#ifndef __EMX__
|
1999-03-07 20:56:03 +08:00
|
|
|
gimp_data_dir = DATADIR;
|
1999-04-24 22:54:47 +08:00
|
|
|
#else
|
|
|
|
gimp_data_dir = g_strdup(__XOS2RedirRoot(DATADIR));
|
|
|
|
#endif
|
1999-03-07 20:56:03 +08:00
|
|
|
#else
|
|
|
|
/* Figure it out from the executable name */
|
|
|
|
char filename[MAX_PATH];
|
|
|
|
char *sep1, *sep2;
|
|
|
|
|
|
|
|
if (GetModuleFileName (NULL, filename, sizeof (filename)) == 0)
|
|
|
|
g_error ("GetModuleFilename failed\n");
|
|
|
|
|
1999-07-30 06:07:17 +08:00
|
|
|
/* If the executable file name is of the format
|
|
|
|
* <foobar>\bin\gimp.exe of <foobar>\plug-ins\filter.exe, * use
|
|
|
|
* <foobar>. Otherwise, use the directory where the executable
|
1999-03-07 20:56:03 +08:00
|
|
|
* is.
|
|
|
|
*/
|
|
|
|
|
|
|
|
sep1 = strrchr (filename, G_DIR_SEPARATOR);
|
|
|
|
|
|
|
|
*sep1 = '\0';
|
|
|
|
|
|
|
|
sep2 = strrchr (filename, G_DIR_SEPARATOR);
|
|
|
|
|
|
|
|
if (sep2 != NULL)
|
|
|
|
{
|
1999-07-30 06:07:17 +08:00
|
|
|
if (g_strcasecmp (sep2 + 1, "bin") == 0
|
|
|
|
|| g_strcasecmp (sep2 + 1, "plug-ins") == 0)
|
1999-03-07 20:56:03 +08:00
|
|
|
*sep2 = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
gimp_data_dir = g_strdup (filename);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return gimp_data_dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* gimp_gtkrc returns the name of the GIMP's application-specific
|
|
|
|
* gtkrc file.
|
|
|
|
*
|
|
|
|
* The returned string is allocated just once, and should *NOT* be
|
|
|
|
* freed with g_free().
|
|
|
|
*/
|
|
|
|
char*
|
|
|
|
gimp_gtkrc ()
|
|
|
|
{
|
|
|
|
static char *gimp_gtkrc_filename = NULL;
|
|
|
|
|
|
|
|
if (gimp_gtkrc_filename != NULL)
|
|
|
|
return gimp_gtkrc_filename;
|
|
|
|
|
|
|
|
|
|
|
|
gimp_gtkrc_filename = g_strconcat (gimp_directory (),
|
|
|
|
G_DIR_SEPARATOR_S,
|
|
|
|
"gtkrc",
|
|
|
|
NULL);
|
|
|
|
return gimp_gtkrc_filename;
|
|
|
|
}
|