For example, there are backup and versioning apps which monitor filesystem changes. I’m not just talking about the scenario that gave me the headache which occasioned this post, but other scenarios as well. However, this roundabout way of modifying files can cause problems with software that monitors file changes. Making a temporary file first guarantees that you will always be able to get your data back. If ST3 simply overwrote the original file and something really bad happened during the overwrite, you could lose data. Why does Sublime Text 3 save your files in such a weird way? It’s supposed to be a safety feature. If the read operation was quick enough (which would have depended on things like the overall disk load), Equalizer APO would find the file missing. Rename the temporary file so that it looks like the original file.Īt the exact moment when ST3 deleted the original file, Windows would notify Equalizer APO about the “change” and cause it to re-read the file.Write the modified text into a temporary file.It turns out, when you save a file in Sublime Text 3, in its default configuration, it doesn’t simply overwrite it like all other editors. Could it somehow be hiding the file from Equalizer APO? I tried opening the file in Komodo Edit - it worked just like it did in Notepad.Ī-ha! Clearly Sublime Text 3 was doing something weird with the file. Back to Sublime Text 3 - it stopped working. I could edit the file as much as I wanted, and every change was applied. How could Equalizer APO not find a file that was clearly there? And why was it unable to find the file only some of the time? After spending an hour studying the source code for Equalizer APO, I grew convinced that the only possible reason was a bug in Equalizer APO which somehow blocks access to the config.txt file (after all, weird contention issues are not unheard of in multithreaded apps) combined with an obscure Windows bug which results in CreateFile() reporting a sharing violation as a missing file.Īfter submitting a lengthy and detailed bug report to the author of Equalizer APO, I accidentally opened config.txt in Notepad instead of Sublime Text 3, my go-to text editor… The system cannot find the file specified. The weirdest thing was that whenever I changed config.txt, Equalizer APO wrote the following message to its log: Error while reading configuration file: I tried fiddling around with folder permissions and moving the config.txt file to various locations on the hard drive, which seemed to fix the issue for some time (usually until the next reboot). For example, the first two changes after reboot might get applied, but subsequent changes would be ignored. Soon after installing Equalizer APO on a fresh Windows installation, I noticed that the changes I was making in config.txt were often being ignored. Normally, you can hear the sound playing on your PC change within a few seconds of saving the file. Maybe I’ll write a post about it some day - it’s awesome.)Įqualizer APO uses a plain text config file (config.txt) that it constantly monitors for changes using a mechanism provided by Windows. ( Equalizer APO is a free equalizer that plugs into the Windows Audio subsystem, which lets you, among other things, correct the acoustic flaws of your room to dramatically improve the quality of all audio playing on your computer. I just spent a day investigating a really baffling bug that occurred when I installed Equalizer APO on a new Windows machine.
0 Comments
Leave a Reply. |