[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] On windows, default to ~/mixminion/ instead of ~/.mixmi...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv2175/lib/mixminion

Modified Files:
	ClientMain.py Config.py 
Log Message:
On windows, default to ~/mixminion/ instead of ~/.mixminion/

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- ClientMain.py	28 Nov 2003 04:14:03 -0000	1.134
+++ ClientMain.py	4 Dec 2003 05:50:36 -0000	1.135
@@ -145,6 +145,11 @@
     LOG.warn("No configuration file found. Installing default file in %s",
                   fname)
 
+    fields = { 'ud_default' : '~/.mixminion' }
+
+    if sys.platform == 'win32':
+        fields['ud_default'] = 'mixminion'
+
     writeFile(os.path.expanduser(fname),
               """\
 # This file contains your options for the mixminion client.
@@ -161,9 +166,9 @@
 # Other options not yet implemented
 
 [User]
-## By default, mixminion puts your files in ~/.mixminion.  You can override
+## By default, mixminion puts your files in %(ud_default)s,  You can override
 ## this directory here.
-#UserDir: ~/.mixminion
+#UserDir: %(ud_default)s
 
 [Security]
 ## Address to use by default when generating reply blocks
@@ -181,7 +186,7 @@
 
 [Network]
 ConnectionTimeout: 60 seconds
-""")
+""" % fields)
 
 class MixminionClient:
     #XXXX Once ClientAPI is more solid, this class should be folded into it.

Index: Config.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Config.py,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- Config.py	28 Nov 2003 04:14:04 -0000	1.69
+++ Config.py	4 Dec 2003 05:50:36 -0000	1.70
@@ -935,6 +935,15 @@
 
         return "".join(lines)
 
+
+if sys.platform == 'win32':
+    # Windows prefers to put configuration in different places, depending
+    # on your version, but it doesn't get the idea of dotfiles.
+    DEFAULT_USER_DIR = "~/mixminion"
+else:
+    # Unix prefers to put configuration in hidden directories in your homedir.
+    DEFAULT_USER_DIR = "~/.mixminion"
+
 class ClientConfig(_ConfigFile):
     #XXXX Should this go into ClientUtils or something?
     _restrictFormat = 0
@@ -951,7 +960,7 @@
                      'ServerURL' : ('ALLOW*', None, None),
                      'MaxSkew' : ('ALLOW', "interval", "10 minutes"),
                      'DirectoryTimeout' : ('ALLOW', "interval", "1 minute") },
-        'User' : { 'UserDir' : ('ALLOW', "filename", "~/.mixminion" ) },
+        'User' : { 'UserDir' : ('ALLOW', "filename", DEFAULT_USER_DIR) },
         'Security' : { 'PathLength' : ('ALLOW', "int", "8"),
                        'SURBAddress' : ('ALLOW', None, None),
                        'SURBPathLength' : ('ALLOW', "int", "4"),