I've got the following problem:
Our plugin uses a library which creates temporary files. It works fine outside of Idea. However, when the code is running in Idea, it sometimes fails with exceptions ("access denied", or ".. operation cannot be performed on a file with a user-mapped section open") reported for those temporary files. It does not happen every time, but it's still possible to reproduce it on big data.
I found out that the temporary files are opened (and locked) by the Windows Search indexer. (I can turn it off on my machine, and after that everything works fine. However, it's not a solution for the plugin itself.)
Now, the tricky part. By default, Windows Search indexes content of all files under C:\Users\username, except for AppData (and, in particular, except for AppData\Local\Temp, which is the default temp directory). (Open Start > Indexing Options to see details). However, Idea uses the system directory C:\Users\username\.IdeaIC12\system; and changes the temp directory to C:\Users\username\.IdeaIC12\system\tmp. So, the system temp dir is NOT indexed, but the Idea temp dir IS indexed. After that, new files created using File.createNewFile /Directory are locked by indexer at random time.
There are similar problems reported by other people for files in idea system directory (search for "user-mapped section open" here on forums, or in bug tracker). I could not find an acceptable solution, though - all the answers are "turn off the indexer / antivirus".
Now, the questions:
1) from plugin dev perspectivve: did anyone find a solution for such problem?
- is it possible to somehow obtain the real system temp directory from idea (I can pass that temp directory to the library).
- anyone managed to successfully set NOT_CONTENT_INDEXED flag to files/directories?
2) the Idea itself:
- is it possible to exclude the whole idea system directory from the indexing just after idea installation?
- or, what was the point of changing the temp directory? Isn't it better to use system temp directory?