Mac: Preferences write failure.

I seem to recall seeing a message a little while back about a preferences writing problem on the Mac. I just had something like that happen to me.

Intel Hardware, Mac OS X 10.6.3 (Snow Leopard), Java 1.6

This occurred upon launching Vassal 3.1.14 from a dock shortcut. The error message from the log is the following:

12 Apr 2010 03:45:34.728 0 -- Starting 12 Apr 2010 03:45:34.730 0 -- OS Mac OS X 12 Apr 2010 03:45:34.730 0 -- Java version 1.6.0_17 12 Apr 2010 03:45:34.730 0 -- VASSAL version 3.1.14 12 Apr 2010 03:45:35.450 0 -- Manager 12 Apr 2010 03:45:37.103 0 java.io.IOException: Unable to overwrite /Users/tar/VASSAL/Preferences Data stored in /Users/tar/VASSAL/temp1.zip at VASSAL.tools.ArchiveWriter.write(ArchiveWriter.java:475) at VASSAL.tools.ArchiveWriter.write(ArchiveWriter.java:266) at VASSAL.preferences.PrefsEditor.write(PrefsEditor.java:235) at VASSAL.preferences.Prefs.write(Prefs.java:206) at VASSAL.preferences.Prefs.getGlobalPrefs(Prefs.java:232) at VASSAL.launch.ModuleManager.<init>(ModuleManager.java:288) at VASSAL.launch.ModuleManager.main(ModuleManager.java:169) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at apple.launcher.LaunchRunner.run(LaunchRunner.java:115) at apple.launcher.LaunchRunner.callMain(LaunchRunner.java:50) at apple.launcher.JavaApplicationLauncher.launch(JavaApplicationLauncher.java:52)

What is unusual is that it seems that the Preferences file was indeed written, which leads me to suspect that for some reason it is being written twice, perhaps on two separate threads. Is that possible? It would explain being unable to overwrite the file, since I would suspect that the “Preferences” file would still be open from an overlapping write. What leads me to suspect this is
(a) The permissions are such that the Preferences file is writable by me

[Newfoundland:~/VASSAL] tar% ls -l total 48 -rw-r--r-- 1 tar tar 5623 Apr 11 20:45 Preferences -rw-r--r-- 1 tar tar 1279 Apr 11 20:45 errorLog drwxr-xr-x 2 tar tar 68 Mar 24 2008 ext -rw-r--r-- 1 tar tar 12 Apr 11 20:45 key -rw-r--r-- 1 tar tar 0 Apr 11 20:45 lock drwxr-xr-x 2 tar tar 68 Mar 24 2008 plugins -rw-r--r-- 1 tar tar 5623 Apr 11 20:45 temp1.zip drwxr-xr-x 2 tar tar 68 Apr 5 21:25 tmp
(b) The contents of Preferences and temp1.zip are the same

[code] tar% unzip -l Preferences
Archive: Preferences
Length Date Time Name


  392  04-11-10 20:45   In Their Quiet Fields II
  597  04-11-10 20:45   Sicily
  443  04-11-10 20:45   Unnamed module
  372  04-11-10 20:45   The "best" Game
  738  04-11-10 20:45   VG Vietnam
  399  04-11-10 20:45   Pea Ridge
  125  04-11-10 20:45   Bastogne (Gamers/MMP)
   81  04-11-10 20:45   Three Battles of Manassas
  505  04-11-10 20:45   RAF
   63  04-11-10 20:45   Flying Colors
   63  04-11-10 20:45   OCS - Tunisia
  852  04-11-10 20:45   Silent War
  639  04-11-10 20:45   DAK II
 1243  04-11-10 20:45   VASSAL

 6512                   14 files

[/code]

unzip -l temp1.zip
Archive:  temp1.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
      392  04-11-10 20:45   In Their Quiet Fields II
      597  04-11-10 20:45   Sicily
      443  04-11-10 20:45   Unnamed module
      372  04-11-10 20:45   The "best" Game
      738  04-11-10 20:45   VG Vietnam
      399  04-11-10 20:45   Pea Ridge
      125  04-11-10 20:45   Bastogne (Gamers/MMP)
       81  04-11-10 20:45   Three Battles of Manassas
      505  04-11-10 20:45   RAF
       63  04-11-10 20:45   Flying Colors
       63  04-11-10 20:45   OCS - Tunisia
      852  04-11-10 20:45   Silent War
      639  04-11-10 20:45   DAK II
     1243  04-11-10 20:45   VASSAL
 --------                   -------
     6512                   14 files

 tar% date
Sun Apr 11 20:46:56 PDT 2010

I was having the same issue and seemed to have resolved it by running Vassal in 32bit mode. Ctrl click on the Vassal icon then go to ‘Get info’ and check the box ‘open in 32 bit mode’