diff options
Diffstat (limited to 'mixlib/mix_parser.c')
-rw-r--r-- | mixlib/mix_parser.c | 16 |
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); |