mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* edit-widget.h: Resurrect "dir" field in WEdit to store
directory for relative filenames. * edit.c (edit_clean): Release edit->dir. * editcmd.c (edit_save_file): Use absolute filename. Temporarily disable safe save and backups on remote VFS because it doesn't work - again.
This commit is contained in:
parent
81d396da33
commit
cf9acd036e
@ -1,3 +1,14 @@
|
||||
2003-07-31 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* edit-widget.h: Resurrect "dir" field in WEdit to store
|
||||
directory for relative filenames.
|
||||
|
||||
* edit.c (edit_clean): Release edit->dir.
|
||||
|
||||
* editcmd.c (edit_save_file): Use absolute filename.
|
||||
Temporarily disable safe save and backups on remote VFS because
|
||||
it doesn't work - again.
|
||||
|
||||
2003-07-25 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* edit.c (edit_execute_cmd): Enable user menu in mcedit.
|
||||
|
@ -31,6 +31,7 @@ struct WEdit {
|
||||
int num_widget_columns;
|
||||
|
||||
char *filename; /* Name of the file */
|
||||
char *dir; /* NULL if filename is absolute */
|
||||
|
||||
/* dynamic buffers and cursor position for editor: */
|
||||
long curs1; /* position of the cursor from the beginning of the file. */
|
||||
|
@ -606,6 +606,7 @@ edit_clean (WEdit *edit)
|
||||
|
||||
g_free (edit->undo_stack);
|
||||
g_free (edit->filename);
|
||||
g_free (edit->dir);
|
||||
|
||||
edit_purge_widget (edit);
|
||||
|
||||
|
@ -207,7 +207,14 @@ edit_save_file (WEdit *edit, const char *filename)
|
||||
if (!*filename)
|
||||
return 0;
|
||||
|
||||
if ((fd = mc_open (filename, O_WRONLY | O_BINARY)) == -1) {
|
||||
if (*filename != PATH_SEP && edit->dir) {
|
||||
savename = concat_dir_and_file (edit->dir, filename);
|
||||
filename = catstrs (savename, NULL);
|
||||
g_free (savename);
|
||||
}
|
||||
|
||||
if (!vfs_file_is_local (filename) ||
|
||||
(fd = mc_open (filename, O_WRONLY | O_BINARY)) == -1) {
|
||||
/*
|
||||
* The file does not exists yet, so no safe save or
|
||||
* backup are necessary.
|
||||
@ -426,6 +433,12 @@ edit_set_filename (WEdit *edit, const char *f)
|
||||
if (!f)
|
||||
f = "";
|
||||
edit->filename = g_strdup (f);
|
||||
if (edit->dir == NULL && *f != PATH_SEP)
|
||||
#ifdef USE_VFS
|
||||
edit->dir = g_strdup (vfs_get_current_dir ());
|
||||
#else
|
||||
edit->dir = g_get_current_dir ();
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Here we want to warn the users of overwriting an existing file,
|
||||
|
Loading…
Reference in New Issue
Block a user