From: John Darrington Date: Wed, 13 May 2009 22:54:56 +0000 (+0800) Subject: Ensure that windows opens the right file for output. X-Git-Tag: v0.7.3~125 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=50b850e3c0b7dbe38c3acc6723bec337b0391410 Ensure that windows opens the right file for output. Thanks to Michel Boaventura for reporting this problem. Fixes bug #26542 --- diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 7b254b95..b0eff950 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -127,7 +127,7 @@ on_delete (GtkWidget *w, GdkEvent *event, gpointer user_data) the_output_viewer = NULL; - unlink (OUTPUT_FILE_NAME); + unlink (output_file_name()); return FALSE; } @@ -278,7 +278,7 @@ psppire_output_window_reload (void) struct stat buf; /* If there is no output, then don't do anything */ - if (0 != stat (OUTPUT_FILE_NAME, &buf)) + if (0 != stat (output_file_name(), &buf)) return ; if ( NULL == the_output_viewer ) @@ -319,10 +319,10 @@ reload_viewer (PsppireOutputWindow *ow) */ { GtkTextIter start_iter; - FILE *fp = fopen (OUTPUT_FILE_NAME, "r"); + FILE *fp = fopen (output_file_name(), "r"); if ( !fp) { - g_print ("Cannot open %s\n", OUTPUT_FILE_NAME); + g_critical ("Cannot open %s\n", output_file_name()); return; } @@ -345,10 +345,10 @@ reload_viewer (PsppireOutputWindow *ow) { if ( ow->fp == NULL) { - ow->fp = fopen (OUTPUT_FILE_NAME, "r"); + ow->fp = fopen (output_file_name(), "r"); if ( ow->fp == NULL) { - g_print ("Cannot open %s\n", OUTPUT_FILE_NAME); + g_critical ("Cannot open %s\n", output_file_name()); return; } } diff --git a/src/ui/gui/psppire.c b/src/ui/gui/psppire.c index 017a85f4..3555463f 100644 --- a/src/ui/gui/psppire.c +++ b/src/ui/gui/psppire.c @@ -82,7 +82,6 @@ replace_casereader (struct casereader *s) #define N_(msgid) msgid -const char * output_file_name (void); void diff --git a/src/ui/gui/psppire.h b/src/ui/gui/psppire.h index 408d858b..cfe49e91 100644 --- a/src/ui/gui/psppire.h +++ b/src/ui/gui/psppire.h @@ -26,5 +26,7 @@ void initialize (struct command_line_processor *, int argc, char **argv); void de_initialize (void); void psppire_quit (void); +const char * output_file_name (void); + #endif /* PSPPIRE_H */