Don't create tagmanager status file, seems to be unnecessary (needs testing).

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2033 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2007-11-07 17:57:38 +00:00
parent 31e13db9f1
commit 0f74a88165
3 changed files with 34 additions and 29 deletions

View File

@ -3,6 +3,9 @@
* src/vte.c: Apply patch from Simone Denei to add a "Restart" item to
the VTE popup menu in case running application hangs.
* src/utils.c: Fix bug when creating configuration directory on Unix.
* tagmanager/tm_work_object.c, tagmanager/tm_workspace.c:
Don't create tagmanager status file, seems to be unnecessary
(needs testing).
2007-11-06 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -91,37 +91,45 @@ gboolean tm_work_object_init(TMWorkObject *work_object, guint type, const char *
struct stat s;
int status;
if (0 != (status = g_stat(file_name, &s)))
if (file_name != NULL)
{
if (create)
if (0 != (status = g_stat(file_name, &s)))
{
FILE *f;
if (NULL == (f = g_fopen(file_name, "a+")))
if (create)
{
g_warning("Unable to create file %s", file_name);
return FALSE;
FILE *f;
if (NULL == (f = g_fopen(file_name, "a+")))
{
g_warning("Unable to create file %s", file_name);
return FALSE;
}
fclose(f);
status = g_stat(file_name, &s);
}
fclose(f);
status = g_stat(file_name, &s);
}
if (0 != status)
{
/* g_warning("Unable to stat %s", file_name);*/
return FALSE;
}
if (!S_ISREG(s.st_mode))
{
g_warning("%s: Not a regular file", file_name);
return FALSE;
}
work_object->file_name = tm_get_real_path(file_name);
work_object->short_name = strrchr(work_object->file_name, '/');
if (work_object->short_name)
++ work_object->short_name;
else
work_object->short_name = work_object->file_name;
}
if (0 != status)
else
{
/* g_warning("Unable to stat %s", file_name);*/
return FALSE;
}
if (!S_ISREG(s.st_mode))
{
g_warning("%s: Not a regular file", file_name);
return FALSE;
work_object->file_name = NULL;
work_object->short_name = NULL;
}
work_object->type = type;
work_object->file_name = tm_get_real_path(file_name);
work_object->short_name = strrchr(work_object->file_name, '/');
if (work_object->short_name)
++ work_object->short_name;
else
work_object->short_name = work_object->file_name;
work_object->parent = NULL;
work_object->analyze_time = 0;
work_object->tags_array = NULL;

View File

@ -31,24 +31,18 @@ guint workspace_class_id = 0;
static gboolean tm_create_workspace(const gchar *config_dir)
{
/// TODO check whether the created file is really necessary at all
gchar *file_name = g_strdup_printf("%s%ctagmanager_%ld.%d",
config_dir, G_DIR_SEPARATOR, time(NULL), getpid());
workspace_class_id = tm_work_object_register(tm_workspace_free, tm_workspace_update
, tm_workspace_find_object);
theWorkspace = g_new(TMWorkspace, 1);
if (FALSE == tm_work_object_init(TM_WORK_OBJECT(theWorkspace),
workspace_class_id, file_name, TRUE))
workspace_class_id, NULL, TRUE))
{
g_free(file_name);
g_free(theWorkspace);
theWorkspace = NULL;
g_warning("Failed to initialize workspace");
return FALSE;
}
g_free(file_name);
theWorkspace->global_tags = NULL;
theWorkspace->work_objects = NULL;
return TRUE;