GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Sat Sep 20, 2014 2:00 pm

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 
Offline
Familiar Face

Joined: Sun Feb 12, 2012 2:23 pm
Posts: 7
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)
gtk+-bundle_2.24.10-20120208_win32
Code:
#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, "gfile.glade", 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);
    g_error_free(err);
  }
  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)
    g_dir_close(dir);

  gtk_builder_connect_signals(builder, NULL);
  g_object_unref(G_OBJECT (builder));       
  gtk_widget_show(window);               
  gtk_main();
  return 0;

}


Top
 Profile  
 
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: No registered users 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group