--- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,16 +2,16 @@ AUTOMAKE_OPTIONS = foreign subdir-objects # in the spirit of automake ... -pkglibexecdir = $(libexecdir)/@PACKAGE@/@VERSION_MAJOR@ +pkglibexecdir = $(libexecdir) # Where to send email about bugs and comments (locally) EMAIL = gnuplot-bugs@lists.sourceforge.net # Default help file location -HELPFILE=@GIHDIR@/gnuplot.gih +HELPFILE=share/$(PACKAGE)/$(VERSION_MAJOR)/gnuplot.gih # Generic default driver location -GNUPLOT_DRIVER_DIR=$(pkglibexecdir) +GNUPLOT_DRIVER_DIR=bin # Default X11 driver location X11_DRIVER_DIR=$(pkglibexecdir) @@ -20,16 +20,16 @@ QT_DRIVER_DIR=$(pkglibexecdir) # Default lua driver location -GNUPLOT_LUA_DIR=$(pkgdatadir)/$(VERSION_MAJOR)/lua +GNUPLOT_LUA_DIR=share/$(PACKAGE)/$(VERSION_MAJOR)/lua # Default javascript location -GNUPLOT_JS_DIR=$(pkgdatadir)/$(VERSION_MAJOR)/js +GNUPLOT_JS_DIR=share/$(PACKAGE)/$(VERSION_MAJOR)/js # Default Postscript prologues location -GNUPLOT_PS_DIR=$(pkgdatadir)/$(VERSION_MAJOR)/PostScript +GNUPLOT_PS_DIR=share/$(PACKAGE)/$(VERSION_MAJOR)/PostScript # System-wide initialization file -GNUPLOT_SHARE_DIR=$(pkgdatadir)/$(VERSION_MAJOR) +GNUPLOT_SHARE_DIR=share/$(PACKAGE)/$(VERSION_MAJOR) # There is probably no need to edit anything below this line --- a/src/command.c +++ b/src/command.c @@ -3449,7 +3449,7 @@ # if defined(MSDOS) || defined(OS2) help_ptr = HelpFile; # else - help_ptr = HELPFILE; + help_ptr = RelativePathToGnuplot(HELPFILE); # endif # else /* !SHELFIND */ --- a/src/show.c +++ b/src/show.c @@ -1164,7 +1164,7 @@ char *driverdir = getenv("GNUPLOT_DRIVER_DIR"); #ifdef GNUPLOT_DRIVER_DIR if (!driverdir) - driverdir = GNUPLOT_DRIVER_DIR; + driverdir = RelativePathToGnuplot(GNUPLOT_DRIVER_DIR); #endif fprintf(stderr, "GNUPLOT_DRIVER_DIR = \"%s\"\n", driverdir ? driverdir : ""); @@ -1175,23 +1175,23 @@ #ifdef GNUPLOT_PS_DIR if (psdir == NULL) - psdir = GNUPLOT_PS_DIR; + psdir = RelativePathToGnuplot(GNUPLOT_PS_DIR); #endif if (psdir != NULL) fprintf(stderr, "GNUPLOT_PS_DIR = \"%s\"\n", psdir); } { -#ifndef _WIN32 +#ifndef _MSC_VER char *helpfile = NULL; if ((helpfile = getenv("GNUHELP")) == NULL) # if defined(MSDOS) || defined(OS2) helpfile = HelpFile; # else - helpfile = HELPFILE; + helpfile = RelativePathToGnuplot(HELPFILE); # endif fprintf(stderr, "HELPFILE = \"%s\"\n", helpfile); -#else /* _WIN32 */ +#else /* _MSC_VER */ fprintf(stderr, "HELPFILE = \"" TCHARFMT "\"\n", winhelpname); #endif } --- a/src/syscfg.h +++ b/src/syscfg.h @@ -103,13 +103,21 @@ # if !defined(__WATCOMC__) || (__WATCOMC__ <= 1290) # define S_IFIFO _S_IFIFO # endif -# define HOME "GNUPLOT" -# define PLOTRC "gnuplot.ini" -# define SHELL "\\command.com" -# define DIRSEP1 '\\' -# define DIRSEP2 '/' -# define PATHSEP ';' -# define GNUPLOT_HISTORY_FILE "~\\gnuplot_history" +# ifdef _MSC_VER +# define HOME "GNUPLOT" +# define PLOTRC "gnuplot.ini" +# define SHELL "\\command.com" +# define DIRSEP1 '\\' +# define DIRSEP2 '/' +# define PATHSEP ';' +# define GNUPLOT_HISTORY_FILE "~\\gnuplot_history" +# else +# define HOME "HOME" +# define PLOTRC "~/.gnuplot" +# define DIRSEP1 '/' +# define DIRSEP2 '\\' +# define GNUPLOT_HISTORY_FILE "~/.gnuplot_history" +# endif /* Flags for windows.h: Minimal required platform is Windows 7, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745.aspx --- a/src/win/winmain.c +++ b/src/win/winmain.c @@ -311,16 +311,22 @@ #ifdef UNICODE LPSTR ansi_dir = AnsiText(szPackageDir, encoding); LPSTR rel_path = (char *) gp_realloc(ansi_dir, strlen(ansi_dir) + strlen(path) + 1, "RelativePathToGnuplot"); + LPSTR s; if (rel_path == NULL) { free(ansi_dir); return (LPSTR) path; } #else char * rel_path = (char * ) gp_alloc(strlen(szPackageDir) + strlen(path) + 1, "RelativePathToGnuplot"); + char *s; strcpy(rel_path, szPackageDir); #endif /* szPackageDir is guaranteed to have a trailing backslash */ strcat(rel_path, path); + /* convert slashes to backslashes */ + for (s = rel_path;*s != NUL; s++) + if (*s == DIRSEP2) + *s = DIRSEP1; return rel_path; } @@ -401,6 +401,7 @@ else szLanguageCode = NULL; +#ifdef NO_GIH /* help file name */ GetPrivateProfileString(section, TEXT("HelpFile"), TEXT(""), profile, 80, file); if (profile[0] != NUL) { @@ -413,6 +420,7 @@ /* default name is "wgnuplot-LL.chm" */ winhelpname = LocalisedFile(name, hlpext, TEXT(HELPFILE)); } +#endif /* menu file name */ GetPrivateProfileString(section, TEXT("MenuFile"), TEXT(""), profile, 80, file);