Top |
Basic File OperationsBasic File Operations — Essential VFS operations. This includes creating, moving and deleting files, opening and closing file handles. |
GnomeVFS file operations are, for the most part, patterned after
their POSIX equivalents, with the systematic difference that they
accept URIs rather than paths on the local filesystem. This makes
them easy to learn as if you are already familiar with basic commands
such as open()
, seek()
, write()
, etc you will feel right at home
with GnomeVFS after learning a little about URIs.
GnomeVFSResult gnome_vfs_create (GnomeVFSHandle **handle
,const gchar *text_uri
,GnomeVFSOpenMode open_mode
,gboolean exclusive
,guint perm
);
Create text_uri
according to mode open_mode
. On return, handle
will then
contain a pointer to a handle for the open file.
handle |
pointer to a pointer to a GnomeVFSHandle object. |
|
text_uri |
string representing the uri to create. |
|
open_mode |
mode to leave the file opened in after creation (or |
|
exclusive |
whether the file should be created in "exclusive" mode. i.e. if this flag is nonzero, operation will fail if a file with the same name already exists. |
|
perm |
bitmap representing the permissions for the newly created file (Unix style). |
GnomeVFSResult gnome_vfs_create_uri (GnomeVFSHandle **handle
,GnomeVFSURI *uri
,GnomeVFSOpenMode open_mode
,gboolean exclusive
,guint perm
);
Create uri
according to mode open_mode
. On return, handle
will then
contain a pointer to a handle for the open file.
handle |
pointer to a pointer to a GnomeVFSHandle object. |
|
uri |
uri for the file to create. |
|
open_mode |
open mode. |
|
exclusive |
whether the file should be created in "exclusive" mode. i.e. if this flag is nonzero, operation will fail if a file with the same name already exists. |
|
perm |
bitmap representing the permissions for the newly created file (Unix style). |
GnomeVFSResult gnome_vfs_open (GnomeVFSHandle **handle
,const gchar *text_uri
,GnomeVFSOpenMode open_mode
);
Open text_uri
according to mode open_mode
. On return, handle
will then
contain a pointer to a handle for the open file.
GnomeVFSResult gnome_vfs_open_uri (GnomeVFSHandle **handle
,GnomeVFSURI *uri
,GnomeVFSOpenMode open_mode
);
Open uri
according to mode open_mode
. On return, handle
will then
contain a pointer to a handle for the open file.
GnomeVFSResult
gnome_vfs_close (GnomeVFSHandle *handle
);
Close file associated with handle
.
GnomeVFSResult
gnome_vfs_unlink (const gchar *text_uri
);
Unlink text_uri
(i.e. delete the file).
GnomeVFSResult
gnome_vfs_unlink_from_uri (GnomeVFSURI *uri
);
Unlink uri
(i.e. delete the file).
GnomeVFSResult gnome_vfs_move_uri (GnomeVFSURI *old_uri
,GnomeVFSURI *new_uri
,gboolean force_replace
);
Move a file from uri old_uri
to new_uri
. This will only work if old_uri
and new_uri
are on the same file system. Otherwise, it is necessary
to use the more general gnome_vfs_xfer_uri()
function.
old_uri |
source uri. |
|
new_uri |
destination uri. |
|
force_replace |
if |
GnomeVFSResult gnome_vfs_move (const gchar *old_text_uri
,const gchar *new_text_uri
,gboolean force_replace
);
Move a file from old_text_uri
to new_text_uri
. This will only work
if old_text_uri
and new_text_uri
are on the same file system. Otherwise,
it is necessary to use the more general gnome_vfs_xfer_uri()
function.
old_text_uri |
string representing the source file location. |
|
new_text_uri |
string representing the destination file location. |
|
force_replace |
if |
GnomeVFSResult gnome_vfs_check_same_fs_uris (GnomeVFSURI *source_uri
,GnomeVFSURI *target_uri
,gboolean *same_fs_return
);
Check if source_uri
and target_uri
are on the same file system.
source_uri |
a uri. |
|
target_uri |
another uri. |
|
same_fs_return |
pointer to a boolean variable which will be set to |
GnomeVFSResult gnome_vfs_check_same_fs (const gchar *source
,const gchar *target
,gboolean *same_fs_return
);
Check if source
and target
are on the same file system.
source |
path to a file. |
|
target |
path to another file. |
|
same_fs_return |
pointer to a boolean variable which will be set to |
gboolean
gnome_vfs_uri_exists (GnomeVFSURI *uri
);
Check if the uri points to an existing entity.
GnomeVFSResult gnome_vfs_create_symbolic_link (GnomeVFSURI *uri
,const gchar *target_reference
);
Creates a symbolic link, or eventually, a uri link (as necessary)
at uri
pointing to target_reference
.