[orca] [config] Migration from ~/.orca to XDG-DATA-HOME option
- From: Juanje Ojeda Croissier <jojeda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] [config] Migration from ~/.orca to XDG-DATA-HOME option
- Date: Mon, 26 Jul 2010 02:59:22 +0000 (UTC)
commit 49af893c1894821ef0f868aebf75e42c716db8ef
Author: Juanje Ojeda <jojeda emergya es>
Date: Sun Jul 25 21:59:50 2010 +0200
[config] Migration from ~/.orca to XDG-DATA-HOME option
Added provisional command line option for migrate the user's personal
preferences files from ~/.orca to XDG-DATA-HOME which is more fdo compilant.
By default Orca will use the old ~/.orca unless the user pass the '-m' or
'--migrate-config' option. This let's the betatesters to be using the last
Orca's version with the old config directory, so it doesn't mess with their
stable version's.
src/orca/orca.py | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index fcc3e02..06de5b4 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -1814,11 +1814,9 @@ def usage():
print "-n, --no-setup " + \
_("Skip set up of user preferences")
- # Translators: by default, Orca expects to find its user preferences
- # in a directory called .orca under the user's home directory. This
- # is the description of the command line option
+ # Translators: this is the description of the command line option
# '-u, --user-prefs-dir=dirname' that allows you to specify an alternate
- # location for those user preferences.
+ # location for the user preferences.
#
print "-u, --user-prefs-dir=dirname " + \
_("Use alternate directory for user preferences")
@@ -1866,6 +1864,9 @@ def usage():
print "-f, --forcequit " + \
_("Forces orca to be terminated immediately.")
+ print "-m, --migrate-config " +\
+ "Move the user's preferences from ~/.orca to XDG-DATA-HOME/orca."
+
# Translators: this is the Orca command line option to tell Orca to
# replace any existing Orca process(es) that might be running.
#
@@ -1949,6 +1950,7 @@ def main():
# d is for disabling a feature
# h is for help
# u is for alternate user preferences location
+ # m is for migrate the user preferences location from ~/.orca
# s is for setup
# n is for no setup
# t is for text setup
@@ -1957,7 +1959,7 @@ def main():
#
opts, args = getopt.getopt(
arglist,
- "?stnvld:e:u:",
+ "?stnvlmd:e:u:",
["help",
"user-prefs-dir=",
"enable=",
@@ -1970,6 +1972,7 @@ def main():
"debug",
"debug-file=",
"version",
+ "migrate-config",
"replace"])
for opt, val in opts:
if opt in ("-u", "--user-prefs-dir"):
@@ -1980,6 +1983,14 @@ def main():
except:
debug.printException(debug.LEVEL_FINEST)
+ if opt in ("-m", "--migrate-config"):
+ from xdg.BaseDirectory import xdg_data_home
+ userPrefsDir = os.path.join(xdg_data_home, "orca")
+ oldUserPrefsDir = os.path.join(os.environ["HOME"], ".orca")
+ if os.path.exists(oldUserPrefsDir):
+ os.renames(oldUserPrefsDir, userPrefsDir)
+ settings.userPrefsDir = userPrefsDir
+
if opt in ("-e", "--enable"):
feature = val.strip()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]