pspp-dev
[Top][All Lists]
Advanced

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

Re: Writing journal and output file to current directory


From: Ben Pfaff
Subject: Re: Writing journal and output file to current directory
Date: Wed, 15 Oct 2008 19:53:04 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

If running a program sets the current directory to the program's
installation directory, then the natural question is: What is a
good default place to put PSPP's output files?  

In Unix, one might default to the user's home directory.  As for
Windows, I see the following code in gnulib in lib/glob.c, which
purports to find a user's home directory in Windows:

    #  ifdef WINDOWS32
              /* Windows NT defines HOMEDRIVE and HOMEPATH.  But give preference
                 to HOME, because the user can change HOME.  */
              if (home_dir == NULL || home_dir[0] == '\0')
                {
                  const char *home_drive = getenv ("HOMEDRIVE");
                  const char *home_path = getenv ("HOMEPATH");

                  if (home_drive != NULL && home_path != NULL)
                    {
                      size_t home_drive_len = strlen (home_drive);
                      size_t home_path_len = strlen (home_path);
                      char *mem = alloca (home_drive_len + home_path_len + 1);

                      memcpy (mem, home_drive, home_drive_len);
                      memcpy (mem + home_drive_len, home_path, home_path_len + 
1);
                      home_dir = mem;
                    }
                  else
                    home_dir = "c:/users/default"; /* poor default */
                }
    #  else

If this algorithm were used to pick the default location for PSPP
output files, would that be a worthwhile improvement?

"Michel Boaventura" <address@hidden> writes:

> Programs made to windows usually are executed from it install folder
> and they write all files in a user temp dir. To be able to run psppire
> from other folder, we will need to put all it's dlls on a shared
> folder, like c:\windows\system32, but it isn't a nice thing to do.
> Another problem is that on a server or a network install, a lot of
> users runs psppire at the same time, and those files will be overwrite
> every time.
>
> Let's stop looking at this for now, because there other problems to
> fix first, but I hope that you understand the problem better now.
>
> 2008/10/15 John Darrington <address@hidden>:
>> On Wed, Oct 15, 2008 at 01:33:13PM -0300, Michel Boaventura wrote:
>>
>>     Another issue is that psppire write files in the current directory.
>>     This isn't good on windows, because usually a program stay on
>>     c:\program files, witch isn't writable by default. So for windows we
>>     need to tell psppire to write on a temporary folder.
>>
>>
>> This has been discussed before, but I still don't understand the
>> problem.
>>
>> Firstly, the only files that psppire writes to the current directory
>> are the output file "psppire.txt" and the journal "pspp.jnl".  If it
>> writes any others, that's a bug; please report it.  Those two files
>> are not `temporary' in any sense.  They are the intended output of the
>> program.
>>
>> Secondly, why are you changing directory to C:\Program Files ??
>> Just because psppire is installed there, surely doesn't mean that you
>> have to change to that directory in order to run it?  One would also
>> have the same problem on GNU/Linux --- psppire would normally be
>> installed in /bin, and if I were to type "cd /bin ; ./psppire" then
>> I too would get errors.  But that's not how it works.  Run psppire
>> from the home directory and everything should be fine.
>>
>> I don't have much experience with windows, so perhaps I'm missing
>> something.  Can you try to elaborate this problem.
>>
>> J'
>>
>>
>> --
>> PGP Public key ID: 1024D/2DE827B3
>> fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
>> See http://pgp.mit.edu or any PGP keyserver for public key.
>>
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.6 (GNU/Linux)
>>
>> iD8DBQFI9pf8imdxnC3oJ7MRAnaNAJoD300nAANPtJB+X+3Sg5DGbGESiwCfcI+7
>> cw4c4Z/p6UVlWBJytef+F/E=
>> =LU6k
>> -----END PGP SIGNATURE-----
>>
>>
>
>
> _______________________________________________
> pspp-dev mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/pspp-dev

-- 
Ben Pfaff 
http://benpfaff.org




reply via email to

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