1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-09-03 23:53:09 +02:00

Protect lnk replacement if the target filename already exists

This commit is contained in:
2016-04-13 20:55:54 +02:00
parent 1030555bb5
commit c172e7aa3d

@@ -121,7 +121,17 @@ namespace TweetDick.Migration{
lnk.SetComment(Program.BrandName); // TODO add a tagline
lnk.Save();
File.Move(linkFile,Path.Combine(location,Program.BrandName+".lnk"));
string renamed = Path.Combine(location,Program.BrandName+".lnk");
try{
if (File.Exists(renamed)){
File.Delete(renamed);
}
File.Move(linkFile,renamed);
}catch{
// eh, too bad
}
}
}