Skip to content

Commit

Permalink
Minor unzip logic change
Browse files Browse the repository at this point in the history
  • Loading branch information
loc0 committed Jun 15, 2019
1 parent 672ee83 commit 399c03c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions codeWithMoshDownloader/codeWithMoshDownloader/Downloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,11 @@ private void UnZipArchive(string sectionPath, string filePath)
string filename = Path.GetFileName(file);
string newFilename = Path.Combine(tempDirectory, AddIndex(filename, _currentItemIndex));

if (File.Exists(newFilename))
if (!File.Exists(newFilename))
{
continue;
File.Move(file, newFilename);
}

File.Move(file, newFilename);
string newSectionPath = Path.Combine(sectionPath, AddIndex(filename, _currentItemIndex));

if (!File.Exists(newSectionPath))
Expand All @@ -260,12 +259,11 @@ private void UnZipArchive(string sectionPath, string filePath)

string newTempDirectoryName = Path.Combine(tempDirectory, AddIndex(name, _currentItemIndex));

if (Directory.Exists(newTempDirectoryName))
if (!Directory.Exists(newTempDirectoryName))
{
continue;
Directory.Move(directory, newTempDirectoryName);
}

Directory.Move(directory, newTempDirectoryName);
string newSectionPath = Path.Combine(sectionPath, AddIndex(name, _currentItemIndex));

if (!Directory.Exists(newSectionPath))
Expand Down

0 comments on commit 399c03c

Please sign in to comment.