~ubuntu-branches/debian/experimental/geany/experimental

« back to all changes in this revision

Viewing changes to tagmanager/tm_project.c

  • Committer: Bazaar Package Importer
  • Author(s): Damián Viano
  • Date: 2008-05-02 11:37:45 UTC
  • mfrom: (1.2.1 upstream) (3.1.6 hardy)
  • Revision ID: james.westby@ubuntu.com-20080502113745-xzp4g6dmovrpoj17
Tags: 0.14-1
New upstream release (Closes: #478126)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#ifdef HAVE_FNMATCH_H
19
19
# include <fnmatch.h>
20
20
#endif
 
21
#include <glib/gstdio.h>
21
22
 
22
23
 
23
24
#include "options.h"
72
73
                  , tm_project_find_file);
73
74
        }
74
75
 
75
 
        if ((0 != stat(dir, &s)) || (!S_ISDIR(s.st_mode)))
 
76
        if ((0 != g_stat(dir, &s)) || (!S_ISDIR(s.st_mode)))
76
77
        {
77
78
                g_warning("%s: Not a valid directory", dir);
78
79
                return FALSE;
88
89
                project->ignore = s_ignore;
89
90
        project->file_list = NULL;
90
91
        g_snprintf(path, PATH_MAX, "%s/%s", project->dir, TM_FILE_NAME);
91
 
        if ((0 != stat(path, &s)) || (0 == s.st_size))
 
92
        if ((0 != g_stat(path, &s)) || (0 == s.st_size))
92
93
                force = TRUE;
93
94
        if (FALSE == tm_work_object_init(&(project->work_object),
94
95
                  project_class_id, path, force))
97
98
                g_free(project->dir);
98
99
                return FALSE;
99
100
        }
100
 
        tm_workspace_add_object(TM_WORK_OBJECT(project));
 
101
        if (! tm_workspace_add_object(TM_WORK_OBJECT(project)))
 
102
        {
 
103
                g_warning("Unable to init project file %s", path);
 
104
                g_free(project->dir);
 
105
                return FALSE;
 
106
        }
101
107
        tm_project_open(project, force);
102
108
        if (!project->file_list || (0 == project->file_list->len))
103
109
                tm_project_autoscan(project);
133
139
                        tm_source_file_free(project->file_list->pdata[i]);
134
140
                g_ptr_array_free(project->file_list, TRUE);
135
141
        }
136
 
        tm_workspace_remove_object(TM_WORK_OBJECT(project), FALSE);
 
142
        tm_workspace_remove_object(TM_WORK_OBJECT(project), FALSE, TRUE);
137
143
        g_free(project->dir);
138
144
        tm_work_object_destroy(&(project->work_object));
139
145
}
169
175
#ifdef TM_DEBUG
170
176
                        g_message("%s moved from workspace to project", path);
171
177
#endif
172
 
                        tm_workspace_remove_object(source_file, FALSE);
 
178
                        tm_workspace_remove_object(source_file, FALSE, TRUE);
173
179
                }
174
180
                else if (TM_WORK_OBJECT(project) == source_file->parent)
175
181
                                {
352
358
{
353
359
        struct stat s;
354
360
        char *ignore_file = g_strconcat(project->dir, "/", IGNORE_FILE, NULL);
355
 
        if (0 == stat(ignore_file, &s))
 
361
        if (0 == g_stat(ignore_file, &s))
356
362
        {
357
363
                if (NULL != Option.ignore)
358
364
                        stringListClear(Option.ignore);
373
379
        g_message("Opening project %s", project->work_object.file_name);
374
380
#endif
375
381
        tm_project_set_ignorelist(project);
376
 
        if (NULL == (fp = fopen(project->work_object.file_name, "r")))
 
382
        if (NULL == (fp = g_fopen(project->work_object.file_name, "r")))
377
383
                return FALSE;
378
384
        while (NULL != (tag = tm_tag_new_from_file(source_file, fp, 0)))
379
385
        {
443
449
 
444
450
        if (!project)
445
451
                return FALSE;
446
 
        if (NULL == (fp = fopen(project->work_object.file_name, "w")))
 
452
        if (NULL == (fp = g_fopen(project->work_object.file_name, "w")))
447
453
        {
448
454
                g_warning("Unable to save project %s", project->work_object.file_name);
449
455
                return FALSE;