|
From: <bma...@we...> - 2005-08-09 21:38:11
Attachments:
smime.p7s
|
Currently tilde expansion of paths like "~/gnuplot.history" via gp_expand_tilde() on Windows 9x will fail unless the user sets the HOME environment variable. The string containing the path is left unchanged and does therefore not contain a valid path. This problem came up while I was working on the GNUPLOT_HISTORY patch (see SF). It applies to locating wgnuplot.ini as well as tilde expansion in "load/save" commands. I could think of different solutions: 1) Issue a warning that a certain functionality (e.g. saving of history) of gnuplot requires HOME to be set and do nothing if it is not. (I.e. don't load/save history.) 2) Use a default directory instead, where 'default' could be the current directory or the directory where gnuplot.exe resides. The first being more reasonable for "load/save" commands and the later for locating the history file and wgnuplot.ini. 3) Use a completely different approach to locate files on Windows and disable tilde expansion there as most users of that platform don't know that concept anyway. (No, this would not introduce a lot of #ifdefs. Only gp_expand_tilde would have to be modfied. What would be a good solution? Bastian |
|
From: Hans-Bernhard B. <br...@ph...> - 2005-08-10 13:01:41
|
Bastian M=E4rkisch wrote:
> Currently tilde expansion of paths like "~/gnuplot.history" via gp_expa=
nd_tilde()=20
> on Windows 9x will fail unless the user sets the HOME environment varia=
ble.
And because that's bad, wgnuplot prints this message in such case,=20
right on the startup screen:
warning: no HOME found
> The string containing the path is left unchanged and does therefore not=
contain
> a valid path.=20
There's not much that could usefully be done about that --- there's no=20
single replacement that would be equally applicable for all Windows=20
platforms.
Now that we have the code to locate a suitable fall-back location (for=20
wgnuplot.ini), arguably all other state save files should go there, too
(i.e. gnuplot.ini, the cross-session history file, and whatever else).
> 2) Use a default directory instead, where 'default' could be the curren=
t
> directory or the directory where gnuplot.exe resides.=20
That's pretty much guaranteed to be wrong (not to mention isn't even=20
accessible to normal users on a properly installed, modern Windows).
|
|
From: Bastian M. <bma...@we...> - 2005-08-10 13:57:52
|
Hans-Bernhard Broeker wrote: > Bastian M=E4rkisch wrote: >=20 >> Currently tilde expansion of paths like "~/gnuplot.history" via=20 >> gp_expand_tilde() on Windows 9x will fail unless the user sets the=20 >> HOME environment variable. >=20 >=20 > And because that's bad, wgnuplot prints this message in such case,=20 > right on the startup screen: >=20 > warning: no HOME found >=20 >=20 >> The string containing the path is left unchanged and does therefore=20 >> not contain >> a valid path.=20 >=20 >=20 > There's not much that could usefully be done about that --- there's no = > single replacement that would be equally applicable for all Windows=20 > platforms. >=20 > Now that we have the code to locate a suitable fall-back location (for = > wgnuplot.ini), arguably all other state save files should go there, too= > (i.e. gnuplot.ini, the cross-session history file, and whatever else). Agreed. Possibly it would be even better to have a %APPDATA%\gnuplot directory in that case. >=20 >> 2) Use a default directory instead, where 'default' could be the curre= nt >> directory or the directory where gnuplot.exe resides.=20 >=20 >=20 > That's pretty much guaranteed to be wrong (not to mention isn't even=20 > accessible to normal users on a properly installed, modern Windows). That's why I propsed it as as a fall-back for older versions of Windows (like Win9x) only ... I would propose the following behaviour: 1) Try %HOME% directory from environment. That way gnuplot can adjust to user preferences and it won't break unix-like builds on Windows (cygwin) 2) Try SHGetSpecialFolderPath() or %APPDATA%, if available. Optionally use %APPDATA%\gnuplot directory instead. 3) Issue a warning message (no HOME found) and give up. This means gnuplot now requires HOME to be set for certain functionality. Is that reasonable now? --=20 Bastian M=E4rkisch Physikalisches Institut, Universit=E4t Heidelberg Philosophenweg 12 69120 Heidelberg Tel.: +49-6221-549239 Fax: +49-6221-549343 |
|
From: Hans-Bernhard B. <br...@ph...> - 2005-08-10 14:04:41
|
Bastian Maerkisch wrote: > I would propose the following behaviour: > > 1) Try %HOME% directory from environment. That way > gnuplot can adjust to user preferences and it won't > break unix-like builds on Windows (cygwin) You're forgetting defined behaviour. See "help environment", and what it says abyout %GNUPLOT%. > 3) Issue a warning message (no HOME found) and give up. This > means gnuplot now requires HOME to be set for certain > functionality. No. That would be too harsh. The wording of that warning may have to change, but bailing out is IMHO unacceptable, when the only problem is that a feature the majority of Windows users don't know about would fail to work. They'll notice as they get there. |