mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +01:00
Add doc comments about Windows restrictions on renaming and removing.
2004-12-11 Tor Lillqvist <tml@iki.fi> * glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments about Windows restrictions on renaming and removing. (g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if removal as a file fails. Document this. * glib/gstdio.h: Clarify comment about file name encoding on Windows.
This commit is contained in:
parent
7c596218a6
commit
06f371fb58
@ -1,5 +1,14 @@
|
|||||||
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
|
||||||
|
about Windows restrictions on renaming and removing.
|
||||||
|
|
||||||
|
(g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if
|
||||||
|
removal as a file fails. Document this.
|
||||||
|
|
||||||
|
* glib/gstdio.h: Clarify comment about file name encoding on
|
||||||
|
Windows.
|
||||||
|
|
||||||
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
||||||
still very ugly source file.
|
still very ugly source file.
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
|
||||||
|
about Windows restrictions on renaming and removing.
|
||||||
|
|
||||||
|
(g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if
|
||||||
|
removal as a file fails. Document this.
|
||||||
|
|
||||||
|
* glib/gstdio.h: Clarify comment about file name encoding on
|
||||||
|
Windows.
|
||||||
|
|
||||||
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
||||||
still very ugly source file.
|
still very ugly source file.
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
|
||||||
|
about Windows restrictions on renaming and removing.
|
||||||
|
|
||||||
|
(g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if
|
||||||
|
removal as a file fails. Document this.
|
||||||
|
|
||||||
|
* glib/gstdio.h: Clarify comment about file name encoding on
|
||||||
|
Windows.
|
||||||
|
|
||||||
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
||||||
still very ugly source file.
|
still very ugly source file.
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
|
||||||
|
about Windows restrictions on renaming and removing.
|
||||||
|
|
||||||
|
(g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if
|
||||||
|
removal as a file fails. Document this.
|
||||||
|
|
||||||
|
* glib/gstdio.h: Clarify comment about file name encoding on
|
||||||
|
Windows.
|
||||||
|
|
||||||
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
||||||
still very ugly source file.
|
still very ugly source file.
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
2004-12-11 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
|
* glib/gstdio.c (g_rename, g_unlink, g_remove): Add doc comments
|
||||||
|
about Windows restrictions on renaming and removing.
|
||||||
|
|
||||||
|
(g_remove): Mimic POSIX remove() on Windows: Try also to rmdir if
|
||||||
|
removal as a file fails. Document this.
|
||||||
|
|
||||||
|
* glib/gstdio.h: Clarify comment about file name encoding on
|
||||||
|
Windows.
|
||||||
|
|
||||||
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
* glib/gspawn-win32.c: Fix #157255. Also some refactoring of this
|
||||||
still very ugly source file.
|
still very ugly source file.
|
||||||
|
|
||||||
|
@ -106,7 +106,11 @@ g_open (const gchar *filename,
|
|||||||
* A wrapper for the POSIX rename() function. The rename() function
|
* A wrapper for the POSIX rename() function. The rename() function
|
||||||
* renames a file, moving it between directories if required.
|
* renames a file, moving it between directories if required.
|
||||||
*
|
*
|
||||||
* See the C library manual for more details about rename().
|
* See your C library manual for more details about how rename() works
|
||||||
|
* on your system. Note in particular that on Windows, it is in
|
||||||
|
* general not possible to rename a file if a file with the new name
|
||||||
|
* already exists. Also it is not possible in general to rename an
|
||||||
|
* open file.
|
||||||
*
|
*
|
||||||
* Returns: 0 if the renaming succeeded, -1 if an error occurred
|
* Returns: 0 if the renaming succeeded, -1 if an error occurred
|
||||||
*
|
*
|
||||||
@ -283,9 +287,11 @@ g_lstat (const gchar *filename,
|
|||||||
* file and no processes have it opened, the diskspace occupied by the
|
* file and no processes have it opened, the diskspace occupied by the
|
||||||
* file is freed.
|
* file is freed.
|
||||||
*
|
*
|
||||||
* See the C library manual for more details about unlink().
|
* See your C library manual for more details about unlink(). Note
|
||||||
|
* that on Windows, it is in general not possible to delete files that
|
||||||
|
* are open to some process, or mapped into memory.
|
||||||
*
|
*
|
||||||
* Returns: 0 if the directory was successfully created, -1 if an error
|
* Returns: 0 if the name was successfully deleted, -1 if an error
|
||||||
* occurred
|
* occurred
|
||||||
*
|
*
|
||||||
* Since: 2.6
|
* Since: 2.6
|
||||||
@ -326,12 +332,18 @@ g_unlink (const gchar *filename)
|
|||||||
* @filename: a pathname in the GLib file name encoding
|
* @filename: a pathname in the GLib file name encoding
|
||||||
*
|
*
|
||||||
* A wrapper for the POSIX remove() function. The remove() function
|
* A wrapper for the POSIX remove() function. The remove() function
|
||||||
* deletes a name from the filesystem. It calls unlink() for files
|
* deletes a name from the filesystem.
|
||||||
* and rmdir() for directories.
|
|
||||||
*
|
*
|
||||||
* See the C library manual for more details about remove().
|
* See your C library manual for more details about how remove() works
|
||||||
|
* on your system. On Unix, remove() removes also directories, as it
|
||||||
|
* calls unlink() for files and rmdir() for directories. On Windows,
|
||||||
|
* although remove() in the C library only works for files, this
|
||||||
|
* function tries both remove() and rmdir(), and thus works like on
|
||||||
|
* Unix. Note however, that on Windows, it is in general not possible
|
||||||
|
* to remove a file that is open to some process, or mapped into
|
||||||
|
* memory.
|
||||||
*
|
*
|
||||||
* Returns: 0 if the directory was successfully created, -1 if an error
|
* Returns: 0 if the file was successfully removed, -1 if an error
|
||||||
* occurred
|
* occurred
|
||||||
*
|
*
|
||||||
* Since: 2.6
|
* Since: 2.6
|
||||||
@ -343,8 +355,13 @@ g_remove (const gchar *filename)
|
|||||||
if (G_WIN32_HAVE_WIDECHAR_API ())
|
if (G_WIN32_HAVE_WIDECHAR_API ())
|
||||||
{
|
{
|
||||||
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
|
wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
|
||||||
int retval = _wremove (wfilename);
|
int retval;
|
||||||
int save_errno = errno;
|
int save_errno;
|
||||||
|
|
||||||
|
retval = _wremove (wfilename);
|
||||||
|
if (retval == -1)
|
||||||
|
retval = _wrmdir (wfilename);
|
||||||
|
save_errno = errno;
|
||||||
|
|
||||||
g_free (wfilename);
|
g_free (wfilename);
|
||||||
|
|
||||||
@ -354,8 +371,13 @@ g_remove (const gchar *filename)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
|
gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
|
||||||
int retval = remove (cp_filename);
|
int retval;
|
||||||
int save_errno = errno;
|
int save_errno;
|
||||||
|
|
||||||
|
retval = remove (cp_filename);
|
||||||
|
if (retval == -1)
|
||||||
|
retval = rmdir (cp_filename);
|
||||||
|
save_errno = errno;
|
||||||
|
|
||||||
g_free (cp_filename);
|
g_free (cp_filename);
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@
|
|||||||
* what they are doing and no exchange of files with others this would
|
* what they are doing and no exchange of files with others this would
|
||||||
* be a well-defined encoding, preferrably UTF-8. On Windows, the
|
* be a well-defined encoding, preferrably UTF-8. On Windows, the
|
||||||
* pathname is always in UTF-8, even if that is not the on-disk
|
* pathname is always in UTF-8, even if that is not the on-disk
|
||||||
* encoding or the encoding used by the Win32 API.
|
* encoding, and not the encoding accepted by the C library or Win32
|
||||||
|
* API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int g_open (const gchar *filename,
|
int g_open (const gchar *filename,
|
||||||
|
Loading…
Reference in New Issue
Block a user