Fix generating global tags (geany -g) when the configdir doesn't exist
When creating temporary files for generating global tag files, use the system directory for temporary files rather than the configuration directory, so it works even if the configuration directory doesn't already exist. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5890 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
02dcab4b14
commit
9d2975b8fa
@ -3,6 +3,10 @@
|
||||
* data/filetype_extensions.conf, data/filetypes.Cython.conf,
|
||||
data/filetypes.python:
|
||||
Add Cython filetype (patch by Matthew Brush, thanks).
|
||||
* src/symbols.c, tagmanager/include/tm_workspace.h,
|
||||
tagmanager/tm_workspace.c:
|
||||
Create temporary files used for generating global tags files in the
|
||||
system directory for temp files.
|
||||
|
||||
|
||||
2011-08-15 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
|
||||
|
@ -1624,8 +1624,7 @@ int symbols_generate_global_tags(int argc, char **argv, gboolean want_preprocess
|
||||
|
||||
geany_debug("Generating %s tags file.", ft->name);
|
||||
tm_get_workspace();
|
||||
status = tm_workspace_create_global_tags(app->configdir, command,
|
||||
(const char **) (argv + 2),
|
||||
status = tm_workspace_create_global_tags(command, (const char **) (argv + 2),
|
||||
argc - 2, tags_file, ft->lang);
|
||||
g_free(command);
|
||||
symbols_finalize(); /* free c_tags_ignore data */
|
||||
|
@ -89,8 +89,8 @@ gboolean tm_workspace_load_global_tags(const char *tags_file, gint mode);
|
||||
\param lang The language to use for the tags file.
|
||||
\return TRUE on success, FALSE on failure.
|
||||
*/
|
||||
gboolean tm_workspace_create_global_tags(const char *config_dir, const char *pre_process,
|
||||
const char **includes, int includes_count, const char *tags_file, int lang);
|
||||
gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes,
|
||||
int includes_count, const char *tags_file, int lang);
|
||||
|
||||
/* Recreates the tag array of the workspace by collecting the tags of
|
||||
all member work objects. You shouldn't have to call this directly since
|
||||
|
@ -258,8 +258,22 @@ static void append_to_temp_file(FILE *fp, GList *file_list)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean tm_workspace_create_global_tags(const char *config_dir, const char *pre_process,
|
||||
const char **includes, int includes_count, const char *tags_file, int lang)
|
||||
static gchar *create_temp_file(const gchar *tpl)
|
||||
{
|
||||
gchar *name;
|
||||
gint fd;
|
||||
|
||||
fd = g_file_open_tmp(tpl, &name, NULL);
|
||||
if (fd < 0)
|
||||
name = NULL;
|
||||
else
|
||||
close(fd);
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes,
|
||||
int includes_count, const char *tags_file, int lang)
|
||||
{
|
||||
#ifdef HAVE_GLOB_H
|
||||
glob_t globbuf;
|
||||
@ -273,15 +287,11 @@ gboolean tm_workspace_create_global_tags(const char *config_dir, const char *pre
|
||||
GPtrArray *tags_array;
|
||||
GHashTable *includes_files_hash;
|
||||
GList *includes_files = NULL;
|
||||
#ifdef G_OS_WIN32
|
||||
char *temp_file = g_strdup_printf("%s\\_%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
|
||||
char *temp_file2 = g_strdup_printf("%s\\_%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
|
||||
#else
|
||||
char *temp_file = g_strdup_printf("%s/%d_%ld_1.cpp", config_dir, getpid(), time(NULL));
|
||||
char *temp_file2 = g_strdup_printf("%s/%d_%ld_2.cpp", config_dir, getpid(), time(NULL));
|
||||
#endif
|
||||
gchar *temp_file = create_temp_file("tmp_XXXXXX.cpp");
|
||||
gchar *temp_file2 = create_temp_file("tmp_XXXXXX.cpp");
|
||||
|
||||
if (NULL == theWorkspace || NULL == (fp = g_fopen(temp_file, "w")))
|
||||
if (NULL == temp_file || NULL == temp_file2 ||
|
||||
NULL == theWorkspace || NULL == (fp = g_fopen(temp_file, "w")))
|
||||
{
|
||||
g_free(temp_file);
|
||||
g_free(temp_file2);
|
||||
@ -387,6 +397,7 @@ gboolean tm_workspace_create_global_tags(const char *config_dir, const char *pre
|
||||
else
|
||||
{
|
||||
/* no pre-processing needed, so temp_file2 = temp_file */
|
||||
g_unlink(temp_file2);
|
||||
g_free(temp_file2);
|
||||
temp_file2 = temp_file;
|
||||
temp_file = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user