diff options
Diffstat (limited to 'gvfs')
| -rw-r--r-- | gvfs/Makefile | 20 | ||||
| -rw-r--r-- | gvfs/gvfs.c | 327 | ||||
| l--------- | gvfs/tuxcmd-vfs.h | 1 | ||||
| l--------- | gvfs/vfs_types.h | 1 |
4 files changed, 188 insertions, 161 deletions
diff --git a/gvfs/Makefile b/gvfs/Makefile index 0e1985c..5e7f996 100644 --- a/gvfs/Makefile +++ b/gvfs/Makefile @@ -1,21 +1,20 @@ # path definitions DESTDIR = /usr -INSTALL=install -c +INSTALL = install -c INSTALL_DATA = ${INSTALL} -m 644 # compiler options CC = gcc -CFLAGS =-I. -I/usr/include \ - -Wall -fPIC -O2 -g \ - -DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE +CFLAGS = -I. -I/usr/include \ + -Wall -fPIC -O2 -g \ + -DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -LIB_SUFFIX=`if test \`uname -m\` = x86_64 -o \`uname -m\` = ppc64; then echo 64; fi` +LIB_SUFFIX = `if test \`uname -m\` = x86_64 -o \`uname -m\` = ppc64; then echo 64; fi` -# VFS_COMMON_OBJECTS=strutils.o treepathutils.o treepath_vfs.o vfsutils.o -VFS_COMMON_OBJECTS= +VFS_COMMON_OBJECTS = -VFS_OBJECTS=gvfs.o +VFS_OBJECTS = gvfs.o .SUFFIXES: .c @@ -28,11 +27,6 @@ all shared static: libgvfs_plugin.so libgvfs_plugin.so: $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS) $(CC) -shared -o libgvfs_plugin.so $(VFS_COMMON_OBJECTS) $(VFS_OBJECTS) $(CFLAGS) `pkg-config glib-2.0 gio-2.0 --libs` -strutils.o: strutils.c strutils.h -treepathutils.o: treepathutils.c treepathutils.h -vfsutils.o: vfsutils.c vfsutils.h -treepath_vfs.o: treepath_vfs.c treepath_vfs.h - install:: $(INSTALL) ./libgvfs_plugin.so $(DESTDIR)/lib$(LIB_SUFFIX)/tuxcmd/ diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index 7b15b5e..d72b417 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -1,5 +1,5 @@ /* GVFS plugin for Tux Commander - * Copyright (C) 2008 Tomas Bzatek <tbzatek@users.sourceforge.net> + * Copyright (C) 2008-2009 Tomas Bzatek <tbzatek@users.sourceforge.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -19,35 +19,36 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> -#include <stdint.h> #include <sys/stat.h> -#include <errno.h> +#include <glib.h> #include <gio/gio.h> -#include <glib/gtypes.h> -#include "vfs_types.h" +#include "tuxcmd-vfs.h" -#define VERSION "0.1.10" -#define BUILD_DATE "2009-10-25" +#define VERSION "0.2.0" +#define BUILD_DATE "2009-11-21" #define DEFAULT_BLOCK_SIZE 0x10000 /* 64kB */ -#define CONST_DEFAULT_QUERY_INFO_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," \ - G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_SIZE "," \ - G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "," G_FILE_ATTRIBUTE_TIME_MODIFIED "," \ - G_FILE_ATTRIBUTE_TIME_ACCESS "," G_FILE_ATTRIBUTE_TIME_CHANGED "," \ +#define CONST_DEFAULT_QUERY_INFO_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "," \ + G_FILE_ATTRIBUTE_STANDARD_NAME "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," \ + G_FILE_ATTRIBUTE_STANDARD_SIZE "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET "," \ + G_FILE_ATTRIBUTE_TIME_MODIFIED "," G_FILE_ATTRIBUTE_TIME_ACCESS "," G_FILE_ATTRIBUTE_TIME_CHANGED "," \ G_FILE_ATTRIBUTE_UNIX_MODE "," G_FILE_ATTRIBUTE_UNIX_UID "," \ G_FILE_ATTRIBUTE_UNIX_GID struct TVFSGlobs { TVFSLogFunc log_func; GFile *file; - GFileEnumerator *enumerator; GCancellable *cancellable; + GFileEnumerator *enumerator; + GFile *enumerated_file; + gboolean enum_follow_symlinks; + gboolean enum_add_full_path; + GMainLoop *mount_main_loop; TVFSResult mount_result; int mount_try; @@ -120,10 +121,10 @@ g_error_to_TVFSResult (GError *error) } static void -ask_password_cb (GMountOperation *op, - const char *message, - const char *default_user, - const char *default_domain, +ask_password_cb (GMountOperation *op, + const char *message, + const char *default_user, + const char *default_domain, GAskPasswordFlags flags, gpointer user_data) { @@ -236,9 +237,9 @@ ask_question_cb (GMountOperation *op, } static void -mount_done_cb (GObject *object, +mount_done_cb (GObject *object, GAsyncResult *res, - gpointer user_data) + gpointer user_data) { struct TVFSGlobs *globs; gboolean succeeded; @@ -300,6 +301,7 @@ VFSNew (TVFSLogFunc log_func) globs->file = NULL; globs->enumerator = NULL; + globs->enumerated_file = NULL; globs->cancellable = NULL; globs->break_get_dir_size = FALSE; @@ -314,11 +316,11 @@ VFSNew (TVFSLogFunc log_func) } void -VFSSetCallbacks (struct TVFSGlobs *globs, - TVFSAskQuestionCallback ask_question_callback, - TVFSAskPasswordCallback ask_password_callback, - TVFSProgressCallback progress_func, - void *data) +VFSSetCallbacks (struct TVFSGlobs *globs, + TVFSAskQuestionCallback ask_question_callback, + TVFSAskPasswordCallback ask_password_callback, + TVFSProgressCallback progress_func, + void *data) { globs->callback_ask_question = ask_question_callback; globs->callback_ask_password = ask_password_callback; @@ -330,7 +332,7 @@ void VFSFree (struct TVFSGlobs *globs) { globs->log_func ("GVFS plugin: VFSDestroy"); - free (globs); + g_free (globs); } int @@ -387,7 +389,7 @@ VFSGetNetworkServices () } TVFSResult -VFSOpenURI (struct TVFSGlobs *globs, char *sURI) +VFSOpenURI (struct TVFSGlobs *globs, const char *sURI) { GFile *f, *f2; GFileInfo *info; @@ -458,17 +460,17 @@ VFSClose (struct TVFSGlobs *globs) return cVFS_OK; } -char * -VFSGetPath (struct TVFSGlobs *globs) +static char * +get_absolute_path (GFile *file) { GFile *root; char *path, *s; - if (globs->file) { - root = g_file_resolve_relative_path (globs->file, "/"); + if (file) { + root = g_file_resolve_relative_path (file, "/"); if (root == NULL) return NULL; - path = g_file_get_relative_path (root, globs->file); + path = g_file_get_relative_path (root, file); if (path == NULL) { g_object_unref (root); return NULL; @@ -477,7 +479,6 @@ VFSGetPath (struct TVFSGlobs *globs) s = g_strdup_printf ("/%s", path); else s = g_strdup (path); - g_print ("(II) VFSGetPath: '%s'\n", s); g_free (path); g_object_unref (root); return s; @@ -487,6 +488,17 @@ VFSGetPath (struct TVFSGlobs *globs) } char * +VFSGetPath (struct TVFSGlobs *globs) +{ + char *s; + + s = get_absolute_path (globs->file); + g_print ("(II) VFSGetPath: '%s'\n", s); + + return s; +} + +char * VFSGetPathURI (struct TVFSGlobs *globs) { if (globs->file) @@ -495,56 +507,47 @@ VFSGetPathURI (struct TVFSGlobs *globs) return NULL; } -guint64 -VFSGetFileSystemFree (struct TVFSGlobs *globs, char *APath) +TVFSResult +VFSGetFileSystemInfo (struct TVFSGlobs *globs, const char *APath, gint64 *FSSize, gint64 *FSFree, char **FSLabel) { GFileInfo *info; GError *error; - guint64 res; - - if (globs->file == NULL) - return 0; + TVFSResult res; - error = NULL; - info = g_file_query_filesystem_info (globs->file, G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &error); - if (error) { - g_print ("(EE) VFSGetFileSystemFree: %s\n", error->message); - g_error_free (error); - return 0; - } - res = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE); - g_object_unref (info); - return res; -} - -guint64 -VFSGetFileSystemSize (struct TVFSGlobs *globs, char *APath) -{ - GFileInfo *info; - GError *error; - guint64 res; + if (FSSize) + *FSSize = -1; + if (FSFree) + *FSFree = -1; + if (FSLabel) + *FSLabel = NULL; if (globs->file == NULL) - return 0; + return cVFS_Failed; error = NULL; - info = g_file_query_filesystem_info (globs->file, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE, NULL, &error); + info = g_file_query_filesystem_info (globs->file, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE "," G_FILE_ATTRIBUTE_FILESYSTEM_FREE, NULL, &error); if (error) { - g_print ("(EE) VFSGetFileSystemSize: %s\n", error->message); + g_print ("(EE) VFSGetFileSystemInfo: %s\n", error->message); g_error_free (error); - return 0; + res = cVFS_Failed; } - res = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE); - g_object_unref (info); + else { + if (FSSize) + *FSSize = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE); + if (FSFree) + *FSFree = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_FREE); + res = cVFS_OK; + } + if (info) + g_object_unref (info); return res; } - /**************************************************************************************************************************************/ /**************************************************************************************************************************************/ TVFSResult -VFSChangeDir (struct TVFSGlobs *globs, char *NewPath) +VFSChangeDir (struct TVFSGlobs *globs, const char *NewPath) { GFile *f; GFileEnumerator *en; @@ -616,6 +619,7 @@ VFSChangeDir (struct TVFSGlobs *globs, char *NewPath) } globs->enumerator = en; + globs->enumerated_file = g_file_dup (f); g_object_unref (globs->file); globs->file = f; @@ -627,17 +631,24 @@ VFSChangeDir (struct TVFSGlobs *globs, char *NewPath) /**************************************************************************************************************************************/ static void -g_file_info_to_TVFSItem (GFileInfo *info, struct TVFSItem *Item) +g_file_info_to_TVFSItem (GFileInfo *info, struct TVFSItem *Item, GFile *reference_file, gboolean follow_symlinks, gboolean add_full_path) { + GFileInfo *symlink_info = NULL; + GError *error; + g_assert (info != NULL); g_assert (Item != NULL); - Item->FName = g_strdup (g_file_info_get_name (info)); - Item->FDisplayName = g_strdup (g_file_info_get_display_name (info)); - Item->sLinkTo = g_file_info_get_symlink_target (info) == NULL ? NULL : g_strdup (g_file_info_get_symlink_target (info)); - Item->iSize = g_file_info_get_size (info); - Item->iPackedSize = -1; - Item->iMode = g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE); + if (add_full_path) { + Item->FName = get_absolute_path (reference_file); + if (Item->FName == NULL) + Item->FName = g_strdup (g_file_info_get_name (info)); + Item->FDisplayName = g_filename_display_name (Item->FName); + } else { + Item->FName = g_strdup (g_file_info_get_name (info)); + Item->FDisplayName = g_strdup (g_file_info_get_display_name (info)); + } + Item->sLinkTo = g_strdup (g_file_info_get_symlink_target (info)); Item->m_time = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_MODIFIED); Item->a_time = g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_TIME_ACCESS); @@ -648,31 +659,38 @@ g_file_info_to_TVFSItem (GFileInfo *info, struct TVFSItem *Item) // g_print ("(II) g_file_info_to_TVFSItem: type = %d\n", g_file_info_get_file_type (info)); // g_print ("(II) g_file_info_to_TVFSItem: UNIX_MODE = %d\n", Item->iMode); - if (g_file_info_get_is_symlink (info)) { - Item->ItemType = vSymlink; - } - else - { - switch (g_file_info_get_file_type (info)) { - case G_FILE_TYPE_REGULAR: - Item->ItemType = vRegular; - break; - case G_FILE_TYPE_DIRECTORY: - case G_FILE_TYPE_SHORTCUT: /* Used in network:/// */ - case G_FILE_TYPE_MOUNTABLE: - Item->ItemType = vDirectory; - break; - case G_FILE_TYPE_SYMBOLIC_LINK: - Item->ItemType = vSymlink; - break; - case G_FILE_TYPE_SPECIAL: /* socket, fifo, blockdev, chardev */ - Item->ItemType = vBlockdev; - break; - case G_FILE_TYPE_UNKNOWN: - default: Item->ItemType = vRegular; + Item->IsLink = g_file_info_get_is_symlink (info); + if (Item->IsLink && follow_symlinks) { + error = NULL; + symlink_info = g_file_query_info (reference_file, CONST_DEFAULT_QUERY_INFO_ATTRIBUTES, + G_FILE_QUERY_INFO_NONE, NULL, &error); + + if (error) { + g_print ("(EE) g_file_info_to_TVFSItem: g_file_query_info() error: %s\n", error->message); + g_error_free (error); } } + Item->iSize = g_file_info_get_size (symlink_info ? symlink_info : info); + Item->iPackedSize = -1; + Item->iMode = g_file_info_get_attribute_uint32 (symlink_info ? symlink_info : info, G_FILE_ATTRIBUTE_UNIX_MODE); + + switch (g_file_info_get_file_type (symlink_info ? symlink_info : info)) { + case G_FILE_TYPE_REGULAR: + Item->ItemType = vRegular; + break; + case G_FILE_TYPE_DIRECTORY: + case G_FILE_TYPE_SHORTCUT: /* Used in network:/// */ + case G_FILE_TYPE_MOUNTABLE: + Item->ItemType = vDirectory; + break; + case G_FILE_TYPE_SPECIAL: /* socket, fifo, blockdev, chardev */ + Item->ItemType = vBlockdev; + break; + case G_FILE_TYPE_UNKNOWN: + default: Item->ItemType = vRegular; + } + /* fallback to default file mode if read fails */ if (Item->iMode == 0) { if (Item->ItemType == vDirectory) @@ -680,14 +698,18 @@ g_file_info_to_TVFSItem (GFileInfo *info, struct TVFSItem *Item) else Item->iMode = S_IRUSR + S_IWUSR + S_IRGRP + S_IROTH; } + + if (symlink_info) + g_object_unref (symlink_info); } TVFSResult -VFSListNext (struct TVFSGlobs *globs, char *sDir, struct TVFSItem *Item) +VFSListNext (struct TVFSGlobs *globs, struct TVFSItem *Item) { GError *error; GFileInfo *info; TVFSResult res; + GFile *f; if (globs->file == NULL) { g_print ("(EE) VFSListNext: globs->file == NULL !\n"); @@ -708,15 +730,54 @@ VFSListNext (struct TVFSGlobs *globs, char *sDir, struct TVFSItem *Item) } if (! error && ! info) return cVFS_No_More_Files; - g_file_info_to_TVFSItem (info, Item); + + f = g_file_get_child (globs->enumerated_file, g_file_info_get_name (info)); + g_file_info_to_TVFSItem (info, Item, f, globs->enum_follow_symlinks, globs->enum_add_full_path); + g_object_unref (f); + g_object_unref (info); return cVFS_OK; } TVFSResult -VFSListFirst (struct TVFSGlobs *globs, char *sDir, struct TVFSItem *Item) +VFSListFirst (struct TVFSGlobs *globs, const char *sDir, struct TVFSItem *Item, gboolean FollowSymlinks, gboolean AddFullPath) { - return VFSListNext (globs, sDir, Item); + GFile *list_file; + GError *error; + TVFSResult res; + + list_file = g_file_resolve_relative_path (globs->file, sDir); + if (! list_file) { + g_print ("(EE) VFSListFirst: list_file == NULL !\n"); + return cVFS_Failed; + } + + if (globs->enumerator == NULL || ! g_file_equal (globs->file, list_file)) { + g_print ("(WW) VFSListFirst: resetting enumerator\n"); + if (globs->enumerator) { + g_file_enumerator_close (globs->enumerator, NULL, NULL); + g_object_unref (globs->enumerator); + } + if (globs->enumerated_file) + g_object_unref (globs->enumerated_file); + globs->enumerated_file = NULL; + error = NULL; + globs->enumerator = g_file_enumerate_children (list_file, CONST_DEFAULT_QUERY_INFO_ATTRIBUTES, + G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); + if (error) { + g_print ("(EE) VFSListFirst: g_file_enumerate_children() error: %s\n", error->message); + res = g_error_to_TVFSResult (error); + g_error_free (error); + g_object_unref (list_file); + return res; + } + globs->enumerated_file = g_object_ref (list_file); + } + globs->enum_follow_symlinks = FollowSymlinks; + globs->enum_add_full_path = AddFullPath; + + g_object_unref (list_file); + return VFSListNext (globs, Item); } TVFSResult @@ -725,10 +786,6 @@ VFSListClose (struct TVFSGlobs *globs) GError *error; TVFSResult res; - if (globs->file == NULL) { - g_print ("(EE) VFSListClose: globs->file == NULL !\n"); - return cVFS_Failed; - } if (globs->enumerator == NULL) { g_print ("(EE) VFSListClose: globs->enumerator == NULL !\n"); return cVFS_Failed; @@ -739,6 +796,8 @@ VFSListClose (struct TVFSGlobs *globs) g_file_enumerator_close (globs->enumerator, NULL, &error); g_object_unref (globs->enumerator); globs->enumerator = NULL; + g_object_unref (globs->enumerated_file); + globs->enumerated_file = NULL; if (error) { g_print ("(EE) VFSListClose: g_file_enumerator_close() error: %s\n", error->message); res = g_error_to_TVFSResult (error); @@ -751,39 +810,8 @@ VFSListClose (struct TVFSGlobs *globs) /**************************************************************************************************************************************/ /**************************************************************************************************************************************/ -long -VFSFileExists (struct TVFSGlobs *globs, const char *FileName, const long Use_lstat) -{ - GFile *f; - GError *error; - GFileInfo *info; - - if (globs->file == NULL) { - g_print ("(EE) VFSFileExists: globs->file == NULL !\n"); - return cVFS_Failed; - } - - f = g_file_resolve_relative_path (globs->file, FileName); - if (f == NULL) { - g_print ("(EE) VFSMkDir: g_file_resolve_relative_path() failed.\n"); - return cVFS_Failed; - } - - error = NULL; - info = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_NAME, - Use_lstat ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : G_FILE_QUERY_INFO_NONE, NULL, &error); - g_object_unref (f); - if (error) { -// g_print ("(EE) VFSFileExists: g_file_query_info() error: %s\n", error->message); - g_error_free (error); - return FALSE; - } - g_object_unref (info); - return TRUE; -} - TVFSResult -VFSFileInfo (struct TVFSGlobs *globs, char *AFileName, struct TVFSItem *Item) +VFSFileInfo (struct TVFSGlobs *globs, const char *AFileName, struct TVFSItem *Item, gboolean FollowSymlinks, gboolean AddFullPath) { GFile *f; GError *error; @@ -804,15 +832,16 @@ VFSFileInfo (struct TVFSGlobs *globs, char *AFileName, struct TVFSItem *Item) error = NULL; info = g_file_query_info (f, CONST_DEFAULT_QUERY_INFO_ATTRIBUTES, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); - g_object_unref (f); if (error) { g_print ("(EE) VFSFileInfo: g_file_query_info() error: %s\n", error->message); res = g_error_to_TVFSResult (error); g_error_free (error); + g_object_unref (f); return res; } - g_file_info_to_TVFSItem (info, Item); + g_file_info_to_TVFSItem (info, Item, f, FollowSymlinks, AddFullPath); g_object_unref (info); + g_object_unref (f); return cVFS_OK; } @@ -956,7 +985,7 @@ VFSMakeSymLink (struct TVFSGlobs *globs, const char *NewFileName, const char *Po } TVFSResult -VFSChmod (struct TVFSGlobs *globs, const char *FileName, const uint Mode) +VFSChmod (struct TVFSGlobs *globs, const char *FileName, guint32 Mode) { GFile *f; GError *error; @@ -987,7 +1016,7 @@ VFSChmod (struct TVFSGlobs *globs, const char *FileName, const uint Mode) } TVFSResult -VFSChown (struct TVFSGlobs *globs, const char *FileName, const uint UID, const uint GID) +VFSChown (struct TVFSGlobs *globs, const char *FileName, guint32 UID, guint32 GID) { GFile *f; GError *error; @@ -1027,7 +1056,7 @@ VFSChown (struct TVFSGlobs *globs, const char *FileName, const uint UID, const u } TVFSResult -VFSChangeTimes (struct TVFSGlobs *globs, char *APath, long mtime, long atime) +VFSChangeTimes (struct TVFSGlobs *globs, const char *APath, guint32 mtime, guint32 atime) { GFile *f; GError *error; @@ -1119,12 +1148,13 @@ VFSGetDirSize_recurse (struct TVFSGlobs *globs, GFile *file, guint64 *size) } guint64 -VFSGetDirSize (struct TVFSGlobs *globs, char *APath) +VFSGetDirSize (struct TVFSGlobs *globs, const char *APath) { GFile *f; guint64 size; - if (globs == NULL) return 0; + if (globs == NULL) + return 0; if (globs->file == NULL) { g_print ("(EE) VFSGetDirSize: globs->file == NULL !\n"); return 0; @@ -1192,14 +1222,14 @@ VFSWriteFile (struct TVFSGlobs *globs, TVFSFileDes FileDescriptor, gpointer Buff } void -VFSSetBlockSize (struct TVFSGlobs *globs, int Value) +VFSSetBlockSize (struct TVFSGlobs *globs, guint32 Value) { if (globs) globs->block_size = Value; } gboolean -VFSIsOnSameFS (struct TVFSGlobs *globs, const char *Path1, const char *Path2) +VFSIsOnSameFS (struct TVFSGlobs *globs, const char *Path1, const char *Path2, gboolean FollowSymlinks) { GFile *file1, *file2; GFileInfo *info1, *info2; @@ -1224,7 +1254,8 @@ VFSIsOnSameFS (struct TVFSGlobs *globs, const char *Path1, const char *Path2) error = NULL; info1 = g_file_query_info (file1, G_FILE_ATTRIBUTE_ID_FILESYSTEM, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); + FollowSymlinks ? G_FILE_QUERY_INFO_NONE : G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, &error); if (error) { g_print ("(EE) VFSIsOnSameFS: g_file_query_info() error: %s\n", error->message); g_error_free (error); @@ -1233,7 +1264,8 @@ VFSIsOnSameFS (struct TVFSGlobs *globs, const char *Path1, const char *Path2) return FALSE; } info2 = g_file_query_info (file2, G_FILE_ATTRIBUTE_ID_FILESYSTEM, - G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, &error); + FollowSymlinks ? G_FILE_QUERY_INFO_NONE : G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, + NULL, &error); if (error) { g_print ("(EE) VFSIsOnSameFS: g_file_query_info() error: %s\n", error->message); g_error_free (error); @@ -1256,7 +1288,7 @@ VFSIsOnSameFS (struct TVFSGlobs *globs, const char *Path1, const char *Path2) } gboolean -VFSTwoSameFiles (struct TVFSGlobs *globs, const char *Path1, const char *Path2) +VFSTwoSameFiles (struct TVFSGlobs *globs, const char *Path1, const char *Path2, gboolean FollowSymlinks) { GFile *file1, *file2; gboolean res; @@ -1274,10 +1306,11 @@ VFSTwoSameFiles (struct TVFSGlobs *globs, const char *Path1, const char *Path2) } if (file2 == NULL) { g_print ("(EE) VFSTwoSameFiles: g_file_resolve_relative_path() failed.\n"); + g_object_unref (file1); return FALSE; } - /* FIXME: we should do some I/O test, we're esentially comparing strings at the moment */ + /* FIXME: we should do some I/O test here, we're esentially comparing strings at the moment */ res = g_file_equal (file1, file2); g_object_unref (file1); g_object_unref (file2); @@ -1307,7 +1340,7 @@ vfs_copy_progress_callback (goffset current_num_bytes, } } -#define TUXCMD_DEFAULT_COPY_FLAGS G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA +#define TUXCMD_DEFAULT_COPY_FLAGS G_FILE_COPY_OVERWRITE | G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA TVFSResult VFSCopyToLocal (struct TVFSGlobs *globs, const char *sSrcName, const char *sDstName, gboolean Append) diff --git a/gvfs/tuxcmd-vfs.h b/gvfs/tuxcmd-vfs.h new file mode 120000 index 0000000..b7f193e --- /dev/null +++ b/gvfs/tuxcmd-vfs.h @@ -0,0 +1 @@ +../common/tuxcmd-vfs.h
\ No newline at end of file diff --git a/gvfs/vfs_types.h b/gvfs/vfs_types.h deleted file mode 120000 index c2235a2..0000000 --- a/gvfs/vfs_types.h +++ /dev/null @@ -1 +0,0 @@ -../common/vfs_types.h
\ No newline at end of file |
