summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-05 21:03:32 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2001-06-05 21:03:32 +0000
commitf706dc27589e785b277e87e0fcf9dc30661cbfba (patch)
tree04413a0ce88662e26b027b3df5538b58302d1f64
parente5f0b6efad459eb609672ea0ed4d3c896496f7a2 (diff)
downloadmdk-f706dc27589e785b277e87e0fcf9dc30661cbfba.tar.gz
mdk-f706dc27589e785b277e87e0fcf9dc30661cbfba.tar.bz2
the src path always correctly stored
-rw-r--r--mixlib/mix_parser.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/mixlib/mix_parser.c b/mixlib/mix_parser.c
index edc048c..d0f58a6 100644
--- a/mixlib/mix_parser.c
+++ b/mixlib/mix_parser.c
@@ -289,19 +289,25 @@ mix_parser_write_code (mix_parser_t *parser, const gchar *code_file,
struct write_code_context_ context;
const gchar *cfname = (code_file) ?
code_file : mix_file_base_name (parser->in_file);
- gchar *dir;
gchar *source_path;
g_return_val_if_fail (parser != NULL, MIX_PERR_INTERNAL);
if (parser->status != MIX_PERR_OK ) return parser->status;
context.parser = parser;
- dir = g_get_current_dir ();
- source_path = g_strconcat (dir, G_DIR_SEPARATOR_S,
- mix_file_base_name (parser->in_file), NULL);
+ if (!g_path_is_absolute (mix_file_base_name (parser->in_file)))
+ {
+ gchar *dir = g_get_current_dir ();
+ source_path = g_strconcat (dir, G_DIR_SEPARATOR_S,
+ mix_file_base_name (parser->in_file), NULL);
+ g_free (dir);
+ }
+ else
+ source_path = g_strdup (mix_file_base_name (parser->in_file));
+
context.file = mix_code_file_new_write (cfname, parser->start, source_path,
debug, parser->symbol_table);
- g_free (dir);
g_free (source_path);
+
if (context.file == NULL) return MIX_PERR_NOOUT;
g_tree_traverse (parser->ins_table, write_code_,
G_IN_ORDER, (gpointer)&context);