projects
/
platform
/
upstream
/
glib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GApplication: add a "resource base path"
[platform/upstream/glib.git]
/
gio
/
gresource-tool.c
diff --git
a/gio/gresource-tool.c
b/gio/gresource-tool.c
index
4bbc688
..
634a83a
100644
(file)
--- a/
gio/gresource-tool.c
+++ b/
gio/gresource-tool.c
@@
-12,9
+12,7
@@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
*
* Author: Matthias Clasen
*/
*
* Author: Matthias Clasen
*/
@@
-37,8
+35,13
@@
#endif
#include <gio/gio.h>
#endif
#include <gio/gio.h>
+#include <glib/gstdio.h>
#include <gi18n.h>
#include <gi18n.h>
+#ifdef G_OS_WIN32
+#include "glib/glib-private.h"
+#endif
+
/* GResource functions {{{1 */
static GResource *
get_resource (const gchar *file)
/* GResource functions {{{1 */
static GResource *
get_resource (const gchar *file)
@@
-142,16
+145,24
@@
get_elf (const gchar *file,
if (elf_version (EV_CURRENT) == EV_NONE )
return NULL;
if (elf_version (EV_CURRENT) == EV_NONE )
return NULL;
- *fd =
open (file, O_RDONLY
);
+ *fd =
g_open (file, O_RDONLY, 0
);
if (*fd < 0)
return NULL;
elf = elf_begin (*fd, ELF_C_READ, NULL);
if (elf == NULL)
if (*fd < 0)
return NULL;
elf = elf_begin (*fd, ELF_C_READ, NULL);
if (elf == NULL)
- return NULL;
+ {
+ g_close (*fd, NULL);
+ *fd = -1;
+ return NULL;
+ }
if (elf_kind (elf) != ELF_K_ELF)
if (elf_kind (elf) != ELF_K_ELF)
- return NULL;
+ {
+ g_close (*fd, NULL);
+ *fd = -1;
+ return NULL;
+ }
return elf;
}
return elf;
}
@@
-468,13
+479,13
@@
cmd_help (gboolean requested,
else if (strcmp (command, "help") == 0)
{
description = _("Print help");
else if (strcmp (command, "help") == 0)
{
description = _("Print help");
- synopsis =
"[COMMAND]"
;
+ synopsis =
_("[COMMAND]")
;
}
else if (strcmp (command, "sections") == 0)
{
description = _("List sections containing resources in an elf FILE");
}
else if (strcmp (command, "sections") == 0)
{
description = _("List sections containing resources in an elf FILE");
- synopsis =
"FILE"
;
+ synopsis =
_("FILE")
;
}
else if (strcmp (command, "list") == 0)
}
else if (strcmp (command, "list") == 0)
@@
-482,7
+493,7
@@
cmd_help (gboolean requested,
description = _("List resources\n"
"If SECTION is given, only list resources in this section\n"
"If PATH is given, only list matching resources");
description = _("List resources\n"
"If SECTION is given, only list resources in this section\n"
"If PATH is given, only list matching resources");
- synopsis =
"FILE [PATH]"
;
+ synopsis =
_("FILE [PATH]")
;
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
@@
-492,14
+503,14
@@
cmd_help (gboolean requested,
"If SECTION is given, only list resources in this section\n"
"If PATH is given, only list matching resources\n"
"Details include the section, size and compression");
"If SECTION is given, only list resources in this section\n"
"If PATH is given, only list matching resources\n"
"Details include the section, size and compression");
- synopsis =
"FILE [PATH]"
;
+ synopsis =
_("FILE [PATH]")
;
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
else if (strcmp (command, "extract") == 0)
{
description = _("Extract a resource file to stdout");
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
else if (strcmp (command, "extract") == 0)
{
description = _("Extract a resource file to stdout");
- synopsis =
"FILE PATH"
;
+ synopsis =
_("FILE PATH")
;
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
option = g_strdup_printf ("[--section %s]", _("SECTION"));
}
@@
-528,7
+539,7
@@
cmd_help (gboolean requested,
else
{
g_string_append_printf (string, _("Usage:\n gresource %s%s%s %s\n\n%s\n\n"),
else
{
g_string_append_printf (string, _("Usage:\n gresource %s%s%s %s\n\n%s\n\n"),
- option ? option : "", option ? " " : "", command, synopsis[0] ?
_(synopsis)
: "", description);
+ option ? option : "", option ? " " : "", command, synopsis[0] ?
synopsis
: "", description);
g_string_append (string, _("Arguments:\n"));
g_string_append (string, _("Arguments:\n"));
@@
-536,11
+547,11
@@
cmd_help (gboolean requested,
g_string_append (string,
_(" SECTION An (optional) elf section name\n"));
g_string_append (string,
_(" SECTION An (optional) elf section name\n"));
- if (strstr (synopsis,
"[COMMAND]"
))
+ if (strstr (synopsis,
_("[COMMAND]")
))
g_string_append (string,
_(" COMMAND The (optional) command to explain\n"));
g_string_append (string,
_(" COMMAND The (optional) command to explain\n"));
- if (strstr (synopsis,
"FILE"
))
+ if (strstr (synopsis,
_("FILE")
))
{
if (strcmp (command, "sections") == 0)
g_string_append (string,
{
if (strcmp (command, "sections") == 0)
g_string_append (string,
@@
-551,10
+562,10
@@
cmd_help (gboolean requested,
" or a compiled resource file\n"));
}
" or a compiled resource file\n"));
}
- if (strstr (synopsis,
"[PATH"
))
+ if (strstr (synopsis,
_("[PATH]")
))
g_string_append (string,
_(" PATH An (optional) resource path (may be partial)\n"));
g_string_append (string,
_(" PATH An (optional) resource path (may be partial)\n"));
- else if (strstr (synopsis,
"PATH"
))
+ else if (strstr (synopsis,
_("PATH")
))
g_string_append (string,
_(" PATH A resource path\n"));
g_string_append (string,
_(" PATH A resource path\n"));
@@
-582,7
+593,6
@@
main (int argc, char *argv[])
void (* function) (const gchar *, const gchar *, const gchar *, gboolean);
#ifdef G_OS_WIN32
void (* function) (const gchar *, const gchar *, const gchar *, gboolean);
#ifdef G_OS_WIN32
- extern gchar *_glib_get_locale_dir (void);
gchar *tmp;
#endif
gchar *tmp;
#endif
@@
-601,8
+611,6
@@
main (int argc, char *argv[])
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
#endif
- g_type_init ();
-
if (argc < 2)
return cmd_help (FALSE, NULL);
if (argc < 2)
return cmd_help (FALSE, NULL);