apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr/file_io/win32 filestat.c
Date Sun, 10 Feb 2002 22:36:42 GMT
brane       02/02/10 14:36:42

  Modified:    file_io/win32 filestat.c
  Log:
  Added Win32 implementation of apr_file_attrs_set.
  Contributed by Jay Freeman (saurik) <saurik@saurik.com>
  
  Revision  Changes    Path
  1.64      +48 -1     apr/file_io/win32/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/filestat.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- filestat.c	7 Feb 2002 00:57:21 -0000	1.63
  +++ filestat.c	10 Feb 2002 22:36:41 -0000	1.64
  @@ -622,5 +622,52 @@
                                                apr_fileattrs_t attributes,
                                                apr_pool_t *cont)
   {
  -   return APR_ENOTIMPL;
  +    DWORD flags;
  +    apr_status_t rv;
  +#if APR_HAS_UNICODE_FS
  +    apr_wchar_t wfname[APR_PATH_MAX];
  +#endif
  +
  +#if APR_HAS_UNICODE_FS
  +    IF_WIN_OS_IS_UNICODE
  +    {
  +        if (rv = utf8_to_unicode_path(wfname,
  +                                      sizeof(wfname) / sizeof(wfname[0]),
  +                                      fname))
  +            return rv;
  +        flags = GetFileAttributesW(wfname);
  +    }
  +#endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
  +    {
  +        flags = GetFileAttributesA(fname);
  +    }
  +#endif
  +
  +    if (flags == 0xFFFFFFFF)
  +        return apr_get_os_error();
  +
  +    if (attributes & APR_FILE_ATTR_READONLY)
  +        flags |= FILE_ATTRIBUTE_READONLY;
  +    else
  +        flags &= !FILE_ATTRIBUTE_READONLY;
  +
  +#if APR_HAS_UNICODE_FS
  +    IF_WIN_OS_IS_UNICODE
  +    {
  +        rv = SetFileAttributesW(wfname, flags);
  +    }
  +#endif
  +#if APR_HAS_ANSI_FS
  +    ELSE_WIN_OS_IS_ANSI
  +    {
  +        rv = SetFileAttributesA(fname, flags);
  +    }
  +#endif
  +
  +    if (rv == 0)
  +        return apr_get_os_error();
  +
  +    return APR_SUCCESS;
   }
  
  
  

Mime
View raw message