Commit 4dfda7ce authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

file out: ask for confirmation to overwrite file

To avoid disrupting existing workflows, the dialog is only shown when
overwrite is disabled. If there is no UI, then it will be assumed that
the file is not overwritten.
parent c6859751
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <vlc_block.h> #include <vlc_block.h>
#include <vlc_fs.h> #include <vlc_fs.h>
#include <vlc_strings.h> #include <vlc_strings.h>
#include <vlc_dialog.h>
#if defined( WIN32 ) || defined( __OS2__ ) #if defined( WIN32 ) || defined( __OS2__ )
# include <io.h> # include <io.h>
...@@ -171,9 +172,23 @@ static int Open( vlc_object_t *p_this ) ...@@ -171,9 +172,23 @@ static int Open( vlc_object_t *p_this )
if (var_GetBool (p_access, SOUT_CFG_PREFIX"sync")) if (var_GetBool (p_access, SOUT_CFG_PREFIX"sync"))
flags |= O_SYNC; flags |= O_SYNC;
#endif #endif
do
{
fd = vlc_open (path, flags, 0666); fd = vlc_open (path, flags, 0666);
if (fd != -1)
break;
if (fd == -1) if (fd == -1)
msg_Err (p_access, "cannot create %s: %m", path); msg_Err (p_access, "cannot create %s: %m", path);
if (overwrite || errno != EEXIST)
break;
flags &= ~O_EXCL;
}
while (dialog_Question (p_access, path,
N_("The output file already exists. "
"If recording continues, the file will be "
"overriden and its content will be lost."),
N_("Keep existing file"),
N_("Overwrite"), NULL) == 2);
free (path); free (path);
if (fd == -1) if (fd == -1)
return VLC_EGENERIC; return VLC_EGENERIC;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment