Home | History | Annotate | Download | only in gio

Lines Matching full:file

61 /* Some of the file replacement code was based on the code from gedit,
105 GLocalFileOutputStream *file;
107 file = G_LOCAL_FILE_OUTPUT_STREAM (object);
109 g_free (file->priv->tmp_filename);
110 g_free (file->priv->original_filename);
111 g_free (file->priv->backup_filename);
112 g_free (file->priv->etag);
154 GLocalFileOutputStream *file;
157 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
163 res = write (file->priv->fd, buffer, count);
173 _("Error writing to file: %s"),
188 GLocalFileOutputStream *file;
192 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
195 if (file->priv->sync_on_close &&
196 fsync (file->priv->fd) != 0)
202 _("Error writing to file: %s"),
213 if (_fstati64 (file->priv->fd, &final_stat) == 0)
214 file->priv->etag = _g_local_file_info_create_etag (&final_stat);
216 res = close (file->priv->fd);
223 _("Error closing file: %s"),
230 if (file->priv->tmp_filename)
232 /* We need to move the temp file to its final place,
233 * and possibly create the backup file
236 if (file->priv->backup_filename)
243 if (g_unlink (file->priv->backup_filename) != 0 &&
255 if (link (file->priv->original_filename, file->priv->backup_filename) != 0)
258 if (g_rename (file->priv->original_filename, file->priv->backup_filename) != 0)
271 if (g_rename (file->priv->original_filename, file->priv->backup_filename) != 0)
289 if (g_rename (file->priv->tmp_filename, file->priv->original_filename) != 0)
295 _("Error renaming temporary file: %s"),
306 if (fstat (file->priv->fd, &final_stat) == 0)
307 file->priv->etag = _g_local_file_info_create_etag (&final_stat);
311 res = close (file->priv->fd);
318 _("Error closing file: %s"),
336 close (file->priv->fd);
344 GLocalFileOutputStream *file;
346 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
348 return g_strdup (file->priv->etag);
354 GLocalFileOutputStream *file;
357 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
359 pos = lseek (file->priv->fd, 0, SEEK_CUR);
370 GLocalFileOutputStream *file;
373 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
375 pos = lseek (file->priv->fd, 0, SEEK_CUR);
407 GLocalFileOutputStream *file;
410 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
412 pos = lseek (file->priv->fd, offset, seek_type_to_lseek (type));
420 _("Error seeking in file: %s"),
441 GLocalFileOutputStream *file;
444 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
448 res = g_win32_ftruncate (file->priv->fd, size);
450 res = ftruncate (file->priv->fd, size);
466 _("Error truncating file: %s"),
481 GLocalFileOutputStream *file;
483 file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
488 return _g_local_file_info_get_from_fd (file->priv->fd,
526 _("Error opening file '%s': %s"),
571 _("Error opening file '%s': %s"),
618 _("Error reading from file: %s"),
639 _("Error writing to file: %s"),
679 /* We only need read access to the original file if we are creating a backup.
680 * We also add O_CREATE to avoid a race if the file was just removed */
687 * when finding out if the file we opened was a symlink */
710 _("Error opening file '%s': %s"),
728 _("Error stating file '%s': %s"),
734 /* not a regular file */
741 _("Target file is a directory"));
746 _("Target file is not a regular file"));
758 _("The file was externally modified"));
767 * tmp file then rename the original file to the backup and the
768 * tmp file to the original name. This is fast but doesn't work
769 * when the file is a link (hard or symbolic) or when we can't
771 * new file.
772 * The second strategy consist simply in copying the old file
773 * to a backup file and rewrite the contents of the file.
844 _("Backup file creation failed"));
858 _("Backup file creation failed"));
864 * original file. If this fails, set the protection
873 _("Backup file creation failed"));
889 _("Backup file creation failed"));
903 _("Backup file creation failed"));
914 /* Seek back to the start of the file after the backup copy */
921 _("Error seeking in file: %s"),
937 _("Error removing old file: %s"),
949 _("Error opening file '%s': %s"),
957 /* Truncate the file at the start */
968 _("Error truncating file: %s"),
1007 /* If the file doesn't exist, create it */
1012 /* The file already exists */
1019 * file to ensure the data is on disk when we rename over the destination.
1021 * old file on some filesystems. (I.E. those that don't guarantee the
1040 _("Error opening file '%s': %s"),