pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: location of psppire.txt


From: unknown-1
Subject: Re: location of psppire.txt
Date: Sat, 21 Feb 2009 16:38:11 +0100

2009/2/17 John Darrington :

>     The problem was the renaming op the psppire.dll from psppire-0.dll to
>     psppire.dll. This is not necessary for the merge version, but still
>     needed for the stable version.
>
> That's interesting.  I wonder what's different.

No idea. Anyway. In the future this problem is solved.

>     Unfortunately the patched psppire still writes psppire.txt en pspp.jnl
>     to the current directory.
>
> Can you try to trace the problem through the default_output_path
> function in src/data/file_name.c  Perhaps the conditional directive
> needs to be changed, or maybe you need to set another environment
> variable.  It should be relatively straightforward for you to debug.

There are several problems in this code: (see <==)
===================
#ifdef WINDOWS32     <== is not recognized in the Cygwin version

/* Apparently windoze users like to see output dumped into their home directory,
   not the current directory (!) */
const char *
default_output_path (void)
{
  static const char *home_dir = NULL;

  /* Windows NT defines HOMEDRIVE and HOMEPATH.  But give preference
     to HOME, because the user can change HOME.  */
  if (home_dir == NULL)
    {
      const char *home_drive = getenv ("HOMEDRIVE");
      const char *home_path = getenv ("HOMEPATH"); <== contains spaces

      if (home_drive != NULL && home_path != NULL)
        home_dir = xasprintf ("%s%s%c",
                              home_drive, home_path, DIRECTORY_SEPARATOR);
      else
        home_dir = "c:/users/default/"; /* poor default */  <== is not
available on Windows 2000 or  XP. I beleave it is in Vista, but not
sure.
    }
  return home_dir;
}

#else
==================
For cygwin the next replacement of the code above works.
=============================
# ifdef  __CYGWIN__

/* Apparently windoze users like to see output dumped into their home directory,
   not the current directory (!) */
const char *
default_output_path (void)
{
  static const char *home_dir = NULL;

  /* Windows NT defines HOMEDRIVE and HOMEPATH.  But for Cygwin I give
preference
     to the Cygwin variable HOME, because it is Linux style and without spaces.
     If HOME is empty, the current directory is used.
  */
  if (home_dir == NULL)
    {
      const char *home = getenv ("HOME");

          if (home != NULL)
                home_dir = xasprintf ("%s%c",home, DIRECTORY_SEPARATOR);
          else
                home_dir = xasprintf ("%s%c",".",DIRECTORY_SEPARATOR);
        }
  return home_dir;
}

#else

==================
In the cygwin based binary on pspp.awardspace.com HOME is mapped to
the same directory as HOMEDRIVE and HOMEPATH. In any Cygwin
installation the HOME variable should map to a writeable directory.

I don't have the time to look for a solution on the Mingw based
installation The HOMEPATH on XP is by default "Documents and
Settings". When this is used as path, PSPPIRE crashes. I guess because
of the spaces in the name.

Hope this helps

Have fun




reply via email to

[Prev in Thread] Current Thread [Next in Thread]