Check-in [bfd001af76]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bugfix: FileInfo.MoveTo also changes the FileInfo's FullName. :-)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1: bfd001af76025c7a56d621e9ba8ae31dbbab3154
User & Date: tinus 2018-03-21 20:08:56
Context
2018-03-21
20:55
Improved readability, added using(). check-in: fea5f79177 user: tinus tags: develop
20:08
Bugfix: FileInfo.MoveTo also changes the FileInfo's FullName. :-) check-in: bfd001af76 user: tinus tags: develop
19:53
Added options for archive and backup directories. check-in: 16163e0aca user: tinus tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ZTUpdater/ZTUpdater.cs.

230
231
232
233
234
235
236
237



238
239
240
241
242
243
244
245
246
247
248
249
250
                    //  to a version-based file name in the same folder.
                    Log($"\t{Entry.FullName}\tbacking up existing file.");
                    try
                    {
                        var BackupName = VersionBasedFolder(File);
                        try
                        {
                            File.MoveTo(BackupName);



                        }
                        catch (Exception ex)
                        {
                            Log($"\t{Entry.FullName}\tFirst attempt: {ex.Message.Trim()}");
                            BackupName = VersionBasedFilename(File);
                            File.MoveTo(BackupName);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log($"\t{Entry.FullName}\tBackup failed: {ex.Message.Trim()}", TraceLevel.Warning);
                    }
                }







|
>
>
>





|







230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
                    //  to a version-based file name in the same folder.
                    Log($"\t{Entry.FullName}\tbacking up existing file.");
                    try
                    {
                        var BackupName = VersionBasedFolder(File);
                        try
                        {
                            System.IO.File.Move(File.FullName, BackupName);
                            if (System.IO.File.Exists(File.FullName))
                                // Then, the move was NOT successful
                                throw new Exception("Unable to move the file.");
                        }
                        catch (Exception ex)
                        {
                            Log($"\t{Entry.FullName}\tFirst attempt: {ex.Message.Trim()}");
                            BackupName = VersionBasedFilename(File);
                            System.IO.File.Move(File.FullName, BackupName);
                        }
                    }
                    catch (Exception ex)
                    {
                        Log($"\t{Entry.FullName}\tBackup failed: {ex.Message.Trim()}", TraceLevel.Warning);
                    }
                }