I have solved the issue with a custom post-update script, which fixes Registry entries and Start Menu shortcuts in order to add the --disable-direct-write
argument.
Shortcuts
As I have stated at @codeSwift4Life's answer, appending --disable-direct-write
won't work with shortcuts to the Update.exe
process (which is actually a Squirrel program). However, I did found out how to append arguments to the --processStart atom.exe
command. See this issue.
Therefore, If you wish to change the Atom shortcut to append --disable-direct-write
, you have to change it from:
C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe
to one of the following lines:
C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe -a "--disable-direct-write" C:\Users\USERNAME\AppData\Local\atom\Update.exe --processStart atom.exe --process-start-args "--disable-direct-write"
Context menu
To change the "Open with Atom" context menu, you have to update a few registry entries. Change them from:
X:\Path\to\atom\app-1.0.xx\atom.exe "%V"
to:
X:\Path\to\atom\app-1.0.xx\atom.exe "%V" --disable-direct-write
Automated post-update script
But since there are many registry entries and since you have to repeat everything after every update (and updates are very frequent), manual changes aren't feasible.
Therefore I have created an automated post-update script, which updates everything automatically. You just have to run it after every Atom update.
The base of my post-update script was this coffee script, which is actually the stock script that overrides all our manual changes.
You have to change the aforementioned script in the following manner:
Change:
createShortcuts = (callback) -> spawnUpdate(['--createShortcut', exeName], callback)
to:
createShortcuts = (callback) -> spawnUpdate(['--createShortcut', exeName, '--process-start-args', '--disable-direct-write'], callback)
Change:
installMenu = (keyPath, arg, callback) -> args = [keyPath, '/ve', '/d', 'Open with Atom'] addToRegistry args, -> args = [keyPath, '/v', 'Icon', '/d', process.execPath] addToRegistry args, -> args = ["#\\command", '/ve', '/d', "# \"#\""] addToRegistry(args, callback)
to:
installMenu = (keyPath, arg, callback) -> args = [keyPath, '/ve', '/d', 'Open with Atom'] addToRegistry args, -> args = [keyPath, '/v', 'Icon', '/d', atomExe] addToRegistry args, -> args = ["#\\command", '/ve', '/d', "# \"#\" --disable-direct-write"] addToRegistry(args, callback)
The atomExe
variable is defined as following (put it at the top, but after the require
lines):
# Get the latest version of atom.exe parentDir = fs.listSync('..').filter (x) -> x.indexOf('app-') > -1; [..., atomDir] = parentDir atomExe = path.join(path.resolve(atomDir), 'atom.exe')
Also, you have to find/replace process.execPath
with atomExe
. This is needed because the script will be run directly via Node, and the process
variable points to Node instead of Atom.
Finally, add the following lines to the end of the script, in order to execute shortcuts and registry updates:
# Update shortcuts, install context menu updateShortcuts -> installContextMenu ->
The script is executed with coffee squirrel-update.coffee
. You should place it into a new subfolder inside the AppData\Local\atom
folder. You will also need fs-plus
and coffee-script
node packages in order to successfully run the script.