1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-02 02:34:08 +02:00

Protect lnk replacement if the target filename already exists

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

View File

@ -121,7 +121,17 @@ private static bool BeginMigration(MigrationDecision decision, Action<Exception>
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
}
}
}