Re: glib and relative file names
- From: "Ardhan Madras" <ajhwb knac com>
- To: "Neil Munro" <neilmunro gmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: glib and relative file names
- Date: Sun, 16 Oct 2011 06:52:50 -0700
I have tried making the argument and
converting it to an absolute path by getting the output of g_get_current_dir
() which I understand to return the current working directory but it
only returns the name of my home directory, which is unusual
Why did you manage to build the file path with g_get_current_dir(),
the result of course is depend on current directory of your program
process that likely to be wrong. g_get_current_dir() return your
home directory path most likely because you invoke your program
from there.
Ardhan
--- neilmunro gmail com wrote:
From: Neil Munro <neilmunro gmail com>
To: gtk-app-devel-list gnome org
Subject: glib and relative file names
Date: Sat, 8 Oct 2011 19:54:13 +0100
Hey guys
I am trying to work out a system to pass files to the
application I am working on, now it can accept absolute paths but it doesn't
seem to like relative paths can someone have a look at my code and see why
the G_FILE_TEST_EXISTS check fails? I have tried making the argument and
converting it to an absolute path by getting the output of g_get_current_dir
() which I understand to return the current working directory, but it only
returns the name of my home directory, which is unusual. Can someone shed
some light on this?
The code I am using is below.
if( argc == 1 ) // If no arguments were passed
gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
else // Check to see if any files were specified on the cmd line
{
gint i;
for( i = 1; i < argc; i++ )
{
g_print( "\n%s\n", argv[ i ] );
if( g_file_test( argv[ i ], G_FILE_TEST_EXISTS ) )
{
g_print( "File exists!\n" );
gtk_window_set_focus( GTK_WINDOW( window ), open_with( argv[ i ], Notebook )
);
}
}
if( gtk_notebook_get_n_pages( GTK_NOTEBOOK( Notebook ) ) == 0 )
gtk_window_set_focus( GTK_WINDOW( window ), New( NULL, Notebook ) );
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]