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:
parent
1030555bb5
commit
c172e7aa3d
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user