From 1a8c82215ce98b046c87010f939c3dcb89f92812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Wed, 3 Nov 2010 20:28:54 +0000 Subject: [PATCH] [INTERPRETER] * BUG: Fix startup current directory detection when running an archive. * BUG: Using a Variant where a stream is requested does not crash the interpreter anymore. git-svn-id: svn://localhost/gambas/trunk@3276 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- main/gbx/gbx_project.c | 8 +++++--- main/gbx/gbx_subr_file.c | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main/gbx/gbx_project.c b/main/gbx/gbx_project.c index 6b31c2eb5..400a9d62a 100644 --- a/main/gbx/gbx_project.c +++ b/main/gbx/gbx_project.c @@ -344,9 +344,11 @@ void PROJECT_init(const char *file) if (EXEC_arch) { - path = FILE_get_dir(file); - - FILE_chdir(path); + if (FILE_is_absolute(file)) + { + path = FILE_get_dir(file); + FILE_chdir(path); + } path = FILE_getcwd(NULL); if (path == NULL) diff --git a/main/gbx/gbx_subr_file.c b/main/gbx/gbx_subr_file.c index 178ca8e71..7b7ca3885 100755 --- a/main/gbx/gbx_subr_file.c +++ b/main/gbx/gbx_subr_file.c @@ -117,6 +117,8 @@ static STREAM *get_default(intptr_t val) ({ \ STREAM *stream; \ \ + VARIANT_undo(_value); \ + \ if ((_can_default) && TYPE_is_integer((_value)->type) && (_value)->_integer.value >= 0 && (_value)->_integer.value <= 2) \ stream = get_default((intptr_t)(_value)->_integer.value); \ else \