Re: PalmDoc document title


Subject: Re: PalmDoc document title
From: Thomas Fletcher (thomasf@qnx.com)
Date: Thu Apr 05 2001 - 11:48:54 CDT


On Thu, 5 Apr 2001, K J MacDonald wrote:

> Bit of a feature request really after I ground to a halt implementing
> this...
>
> Ideally, I'd like the PalmDoc exporter to open a dialogue to prompt for
> the document's category (numeric) and title (string), but what I really
> wanted was for it to title the document with the basename of the filename,
> rather than the full pathname.
>
> However, the basename function would depend on the directory separator, so
> it's not cross platform.

#define UT_PLATFORM_DIR_CHAR '/' /* Unix, QNX, BeOS, Mac X? */
#define UT_PLATFORM_DIR_CHAR '\' /* Windows, Dos */
#define UT_PLATFORM_DIR_CHAR ':' /* Mac < X */

const char *filename;
if(!(filename = strrchr(fullpathname, UT_PLATFORM_DIR_CHAR))) {
        filename = fullpathname;
} else {
        filename++;
}

Put something like this in the UT stuff. Make it copy
into a static buffer like UT_trans*() does to make it more
like basename/dirname if you like.

Thomas
-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 2b25 : Thu Apr 05 2001 - 11:44:19 CDT