pdf-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pdf-devel] New API method in the FileSystem module: pdf_fsys_build_path


From: Aleksander Morgado
Subject: [pdf-devel] New API method in the FileSystem module: pdf_fsys_build_path()
Date: Sun, 18 Apr 2010 12:47:25 +0200

Hi all,

Still, I've got another request which I believe would be for the
FileSystem interface.
http://www.gnupdf.org/flyspray/index.php?do=details&task_id=118

Comments welcome!

-----

The idea is to have a method equivalent to GLib's g_build_filename()
http://library.gnome.org/devel/glib/unstable/glib-Miscellaneous-Utility-Functions.html#g-build-filename


When working with the FS interface, sometimes you may want to build
local paths, for example after getting the list of files in a given
directory, if you want to have the whole path of each children you need
to concatenate <directory> + <dir-separator> + filename. As the
dir-separator character depends on the OS in the disk-FS module, it
makes sense to put the new method in the FS interface.

The API of the new method (with a variable number of arguments) could
then be:
pdf_status_t
pdf_fsys_build_path (pdf_text_t *output, pdf_text_t first_element, ...);

If PDF_OK returned, `output' will be a newly allocated pdf_text_t object
with the proper concatenations.

Example:
pdf_text_t full_path = NULL;
pdf_text_t filename = NULL;
pdf_text_t parent_path = get_current_dir_as_text (); /* for example */

pdf_text_new_from_from_unicode ("filename.txt",
                                strlen ("filename.txt"),
                                PDF_TEXT_UTF8,
                                &filename);

pdf_fsys_build_path (&full_path,
                     parent_dir,
                     filename);


-- 
Aleksander





reply via email to

[Prev in Thread] Current Thread [Next in Thread]