Tuesday 13 December 2022

How to prevent DropBox interfering with compilers and other programs

I have good internet performance and I use a local DropBox folder which is synchronised to the 'Cloud'. This works well for all the files that I want to backup and preserve.

I also put all my development folders in the DropBox folder so that, should I have a disk failure or damaged/corrupted filesystem, I will not lose any recent changes and days of work.

Of course, I make offline backups too, but this maybe only once a month or at the finish of a new project or project update.

One of my projects uses Inno Setup to make a self-installing .exe file, however, I noticed that very often the Inno Setup compile operation would fail to complete when using a project which contained files situated in a DropBox folder. I could try compiling maybe five times before the last attempt would work. If I used a non-DropBox folder then there was never any problem. Presumably, DropBox was busy synchronising any recently changed files and this interfered with the compiler.

To fix the issue I decided to write a small batch file to temporarily suspend dropbox, run Inno Setup and then re-enable DropBox. Here is a simplified example:

REM suspend dropbox
pssuspend dropbox  >nul 2>&1
"c:\Program Files (x86)\Inno Setup 6\ISCC.exe" .\_InnoE2B.iss > nul
if errorlevel 1 echo FAILED! & PAUSE
REM re-enable dropbox
pssuspend dropbox -r > nul

This seems to do the trick!

No comments:

Post a Comment