[chronojump] ForceSensor and RunEncoder export with images care for existing folder



commit ec4a7d395625ee93ee45296f5f167752c1bb2056
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 4 13:53:22 2021 +0100

    ForceSensor and RunEncoder export with images care for existing folder

 src/gui/app1/encoder.cs | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index b02f1f34..793683e6 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2198,13 +2198,13 @@ public partial class ChronoJumpWindow
 
                // 3) prepare and Run the dialog
 
-               FileChooserAction fcAction = FileChooserAction.Save;
+               FileChooserAction fcAction = FileChooserAction.Save; //if change this action, change it below 
on the File.Exists
                if(
                                checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
                                checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES ||
                                checkFileOp == 
Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
                                checkFileOp == 
Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
-                       fcAction = FileChooserAction.CreateFolder;
+                       fcAction = FileChooserAction.CreateFolder; //if change this action, change it below 
on the Directory.Exists
 
                Gtk.FileChooserDialog fc=
                        new Gtk.FileChooserDialog(exportString,
@@ -2242,15 +2242,19 @@ public partial class ChronoJumpWindow
                        }
 
                        try {
-                               if (File.Exists(exportFileName)) {
+                               if(
+                                               ( fcAction == FileChooserAction.Save && 
File.Exists(exportFileName) ) ||
+                                               ( fcAction == FileChooserAction.CreateFolder && 
Directory.Exists(exportFileName) ) )
+                               {
                                        LogB.Information(string.Format(
-                                                               "File {0} exists with attributes {1}, created 
at {2}", 
+                                                               "File or dir {0} exists with attributes {1}, 
created at {2}",
                                                                exportFileName, 
                                                                File.GetAttributes(exportFileName), 
                                                                File.GetCreationTime(exportFileName)));
                                        LogB.Information("Overwrite...");
+
                                        ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
-                                                               "Are you sure you want to overwrite file: "), 
"", 
+                                                               "Are you sure you want to overwrite: "), "",
                                                        exportFileName);
 
                                        if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]