mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-25 08:34:05 +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.SetComment(Program.BrandName); // TODO add a tagline
|
||||||
lnk.Save();
|
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