[orca/new-settings] Fix for bug #628569 - Orca preferences are not getting saved permanently if a $HOME/.orca exists
- From: Juanje Ojeda Croissier <jojeda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Fix for bug #628569 - Orca preferences are not getting saved permanently if a $HOME/.orca exists
- Date: Tue, 14 Sep 2010 00:52:19 +0000 (UTC)
commit b600eb8416239ebd3bfdf85abffdae3368f0adef
Author: Alejandro Leiva <aleiva emergya es>
Date: Mon Sep 13 12:19:47 2010 +0200
Fix for bug #628569 - Orca preferences are not getting saved permanently if a $HOME/.orca exists
src/orca/orca.py | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 7c5a56e..85e1692 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -2170,20 +2170,25 @@ def main():
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):
- try:
- shutil.copytree(oldUserPrefsDir, userPrefsDir)
- except:
- for name in os.listdir(oldUserPrefsDir):
- srcPath = os.path.join(oldUserPrefsDir, name)
- dstPath = os.path.join(userPrefsDir, name)
- if os.path.isfile(srcPath):
- shutil.copy(srcPath, dstPath)
- elif os.path.isdir(srcPath):
- if not os.path.isdir(dstPath):
- os.mkdir(dstPath)
- settings.userPrefsDir = userPrefsDir
+ if not os.path.exists(userPrefsDir):
+ os.mkdir(userPrefsDir)
+
+ for baseDirName, dirNames, fileNames in os.walk(oldUserPrefsDir):
+
+ for dirName in dirNames:
+ dstDir = os.path.join(userPrefsDir, dirName)
+ if not os.path.exists(dstDir):
+ os.mkdir(dstDir)
+
+ for fileName in fileNames:
+ srcFile = os.path.join(baseDirName, fileName)
+ relPath = os.path.relpath(baseDirName, oldUserPrefsDir)
+ dstFile = os.path.join(os.path.join(userPrefsDir, relPath), fileName)
+ if not os.path.exists(dstFile):
+ shutil.copy(srcFile, dstFile)
+
+ settings.userPrefsDir = userPrefsDir
# Do not run Orca if accessibility has not been enabled.
# We do allow, however, one to force Orca to run via the
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]