Re: file chooser dialog
- From: Wallace Owen <wallace owen L-3Com com>
- To: Roland Koebler <rk-list koebler com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: file chooser dialog
- Date: Mon, 31 Jul 2006 15:00:09 -0700
You need to normalize the paths, then you can string compare them.
Given that the current directory were /tmp/barb, normalizing the path
will transform ./../file and /tmp/barb/file into ./file.
// Wally
On Mon, 2006-07-31 at 23:36 +0200, Roland Koebler wrote:
hi,
Does anybody also have an idea, how to realize the decision, if a path is
below another one (platform independent would be nice but not absolutely
necessary).
maybe there already is such a function in a library - I don't know.
but you can use glib. look here:
http://developer.gnome.org/doc/API/2.0/glib/glib-Miscellaneous-Utility-Functions
..html
Unfortunately the function must work with relative paths also (so tring
comparison is not possible).
look i.e. at: g_path_is_absolute, g_get_current_dir, g_build_path
with that, you can simply build an absolute path from a relative path.
example:
current = g_get_current_dir();
if( g_path_is_absolute(path) ) absolute = g_strdup( path );
else absolute = g_build_filename(current,path,NULL);
g_free(current);current=0;
....
g_free(absolute);absolute=0;
regards,
Roland
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
--
Your eyes are weary from staring at the CRT. You feel sleepy. Notice
how restful it is to watch the cursor blink. Close your eyes. The
opinions stated above are yours. You cannot imagine why you ever felt
otherwise.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]