Skip to content

Commit

Permalink
Added check if image already exists when installing package
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneMaes0 committed Nov 17, 2023
1 parent 9d38618 commit e62d39e
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,16 @@ namespace Install_1.Images
for(int i = 0; i < images.Length; i++)
{
var image = images[i];
File.Copy(image, Path.Combine(Images_Directory, Path.GetFileName(image)));
Log($"[{i + 1}/{images.Length}] Installed {Path.GetFileName(image)}");
var path = Path.Combine(Images_Directory, Path.GetFileName(image));
if (File.Exists(path))
{
Log($"[{i + 1}/{images.Length}] '{image}' already exists, ignoring this image.");
}
else
{
File.Copy(image, path);
Log($"[{i + 1}/{images.Length}] Installed {Path.GetFileName(image)}");
}
}
}
Expand Down

0 comments on commit e62d39e

Please sign in to comment.