Detect if file is in use

In my project I am deleting folders and the problem is that the app just crashes when deleting a folder while it is open in Windows Explorer. How do I prevent this problem? Could I close the folder from Windows Explorer or Finder and then delete and/or could I catch an exception? The problem is that the app does not seem to fail to delete the folder, even when the folder is open in Explorer?

If this is not a problem in Mac or Linux then obviously that is fine but it would be very preferable if your help applies to Windows, Mac and Linux.

Thanks

Check for folderItem <> Nil, FolderItem.Exists and FolderItem.IsWriteable

If it’s not writeable, then warning the user to close the file is probably your safest solution.

[quote=64984:@Tim Jones]Check for folderItem <> Nil, FolderItem.Exists and FolderItem.IsWriteable

If it’s not writeable, then warning the user to close the file is probably your safest solution.[/quote]
Thanks. I think IsWriteable is what I am looking for?