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:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user