GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Mon Aug 29, 2016 5:23 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: g_file_test windows 7
PostPosted: Sun Nov 03, 2013 5:29 pm 
Familiar Face

Joined: Sun Feb 12, 2012 2:23 pm
Posts: 9
Hello I've got a problem with g_file_test(), its only works on specific folders.
For example its works on g_get_current_dir = F:\progs or g_get_current_dir = F:\progs\paweł, but doesn't on g_get_home_dir = C:\Users\Paweł

gcc version 4.6.2 (GCC)
#include <gtk/gtk.h>

int main(int argc, char *argv[])
  GtkBuilder  *builder;
  GtkWidget   *window, *txt;
  const gchar *home, *files;
  GDir    *dir;
  GError  *err = NULL;

  gtk_init(&argc, &argv);
  builder = gtk_builder_new();
  gtk_builder_add_from_file(builder, "", NULL);
  window = GTK_WIDGET(gtk_builder_get_object (builder, "window"));
  txt = GTK_WIDGET(gtk_builder_get_object (builder, "txt"));

  //home = g_get_home_dir();
  home = g_get_current_dir();
  dir = g_dir_open(home, 0, &err);
  if(dir == NULL)
    fprintf(stderr, "%s\n", err->message);
  while((files = g_dir_read_name(dir)) != NULL)
    //if(g_file_test(files, G_FILE_TEST_IS_DIR))
    if(g_file_test(files, G_FILE_TEST_IS_REGULAR))
      fprintf(stdout, "%s\n", files);
  gtk_entry_set_text(GTK_ENTRY(txt), home);
  if(dir != NULL)

  gtk_builder_connect_signals(builder, NULL);
  g_object_unref(G_OBJECT (builder));       
  return 0;


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot] and 4 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group