replaced glib function calls to g_stat() and g_path_get_basename()