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
commit3ec1b3bb667fd7794a1fbcf81263cb01a901d8c6 (patch)
treef2a739bb36605446c128c3391df4d160c6c94c49
parentb4af47f908b9ad2346a9ccdf6fbea3c9b00e8661 (diff)
downloadmdk-3ec1b3bb667fd7794a1fbcf81263cb01a901d8c6.tar.gz
mdk-3ec1b3bb667fd7794a1fbcf81263cb01a901d8c6.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);