[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem editing file
From: |
Ben Pfaff |
Subject: |
Re: Problem editing file |
Date: |
Thu, 19 Mar 2009 21:16:12 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
John Darrington <address@hidden> writes:
> On Fri, Mar 20, 2009 at 12:26:25AM -0300, Michel Boaventura wrote:
> > I'm also trying to use one windows function to do it (MoveFileEx). Let
> > see if it works.
>
> Well, it works. I can save a file just clicking on the "SAVE" button.
>
> What I did was change the "rename" to:
> ok = MoveFileEx(rf->tmp_name, rf->file_name, MOVEFILE_REPLACE_EXISTING)
> != 0;
>
> and insert an "#include <windows.h>" on the top of the file.
>
> I need to use "!= 0" because it only returns zero if a error happens.
>
> Now I guess that if you or john put a precompiler option to change it
> if we are compiling to linux or windows we could solve this issue.
>
> I don't think it's really pspp's role to fix buggy mingw behaviour.
> It should be done by the the Mingw, libc or gnulib people. (at this
> stage, I'm not sure which). If none of the maintainers of those
> libraries will do it, then we could look at fixing it in pspp, but I
> think that should be a last resort.
I guess that this is a Mingw issue. C99 says the following about
rename:
If a file named by the string pointed to by new exists prior
to the call to the rename function, the behavior is
implementation-defined.
POSIX defines this behavior as (see
http://www.opengroup.org/onlinepubs/009695399/functions/rename.html):
If the directory named by the new argument exists, it shall
be removed and old renamed to new.
Whereas Windows has a contradictory specification (see
http://msdn.microsoft.com/en-us/library/zw5t957f.aspx):
The new name must not be the name of an existing file or
directory.
I guess that we should follow up to a mingw mailing list.
--
Aim to please, shoot to kill.
- Problem editing file, Michel Boaventura, 2009/03/19
- Re: Problem editing file, Ben Pfaff, 2009/03/19
- Re: Problem editing file, Michel Boaventura, 2009/03/19
- Re: Problem editing file, Michel Boaventura, 2009/03/19
- Re: Problem editing file, John Darrington, 2009/03/19
- Re: Problem editing file,
Ben Pfaff <=
- Re: Problem editing file, Michel Boaventura, 2009/03/20
- Re: Problem editing file, Ben Pfaff, 2009/03/20
- Re: Problem editing file, Michel Boaventura, 2009/03/20
- Re: Problem editing file, John Darrington, 2009/03/20
- Re: Problem editing file, Ben Pfaff, 2009/03/20
- Re: Problem editing file, Michel Boaventura, 2009/03/20
- Re: Problem editing file, Michel Boaventura, 2009/03/20
- Re: Problem editing file, Ben Pfaff, 2009/03/20
- Re: Problem editing file, Ben Pfaff, 2009/03/21
- Re: Problem editing file, Michel Boaventura, 2009/03/21