Coffeehouse Post

Single Post Permalink

View Thread: Win7 deletes shortcuts on the desktop
  • User profile image

    , evildictaitor wrote


    There's no race-condition here. If the file exists the shortcut stays. If it doesn't it goes. If the file appears slightly after the shortcut went away, well the shortcut wasn't pointing to something so it deserved to die. If the file disappeared after choosing to keep the shortcut, well you're no better off than before where the shortcut points into the ether.

    You have to take two decisions for network shortcuts, assuming we aren't going to delete them when the network drive isn't available.

    1) Is the network drive available?

    2) Is the target of the shortcut available?

    A race condition is inevitable, since the availability of the network drive between steps 1 and 2 is indeterminate. It's the same anti-pattern that underlies all the IsBadXXXPtr type functions.