New minimum requirement of GTK+2/GLIB for Xarchiver
Jean-François Wauthy
pollux at xfce.org
Thu Aug 3 13:59:16 CEST 2006
Le jeudi 03 août 2006 à 13:33 +0200, Giuseppe Torelli a écrit :
> On 8/3/06, Jean-François Wauthy <pollux at xfce.org> wrote:
>
> > If you want i can took a look and write a
> > xarchive_create_directory_with_parents as explained in my previous mail.
>
> Yes ok, thank you.
there you go:
#include <errno.h>
int
xarchiver_mkdir_with_parents (const gchar * pathname, int mode)
{
if (glib_check_version (2, 8, 0) == NULL) {
return g_mkdir_with_parents (pathname, mode);
}
else {
gchar *fn, *p;
if (pathname == NULL || *pathname == '\0') {
errno = EINVAL;
return -1;
}
fn = g_strdup (pathname);
if (g_path_is_absolute (fn))
p = (gchar *) g_path_skip_root (fn);
else
p = fn;
do {
while (*p && !G_IS_DIR_SEPARATOR (*p))
p++;
if (!*p)
p = NULL;
else
*p = '\0';
if (!g_file_test (fn, G_FILE_TEST_EXISTS)) {
if (g_mkdir (fn, mode) == -1) {
int errno_save = errno;
g_free (fn);
errno = errno_save;
return -1;
}
}
else if (!g_file_test (fn, G_FILE_TEST_IS_DIR)) {
g_free (fn);
errno = ENOTDIR;
return -1;
}
if (p) {
*p++ = G_DIR_SEPARATOR;
while (*p && G_IS_DIR_SEPARATOR (*p))
p++;
}
}
while (p);
g_free (fn);
return 0;
}
}
--
Jean-François Wauthy <pollux at xfce.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 192 bytes
Desc: Ceci est une partie de message num?riquement sign?e
URL: <http://mail.xfce.org/pipermail/xfce4-dev/attachments/20060803/fc16eca0/attachment.pgp>
More information about the Xfce4-dev
mailing list