From 905c27722d8112f1b62f4aca65e583884929bb78 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 24 Nov 2014 00:39:26 +0100 Subject: [PATCH] Allow dictionaries to be placed in %APPDATA%\TortoiseGit\dic Not all people have administrator privileges or want to put their own files into "c:\Program Files". Signed-off-by: Sven Strickroth --- doc/source/en/TortoiseGit/tgit_introduction.xml | 13 ++++++------- src/Changelog.txt | 3 +++ src/Utils/MiscUI/SciEdit.cpp | 15 +++++++++++++-- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/doc/source/en/TortoiseGit/tgit_introduction.xml b/doc/source/en/TortoiseGit/tgit_introduction.xml index 0d418613f..e9102b2dc 100644 --- a/doc/source/en/TortoiseGit/tgit_introduction.xml +++ b/doc/source/en/TortoiseGit/tgit_introduction.xml @@ -311,7 +311,7 @@ . - The installer automatically adds the US and UK English dictionaries. + The installer automatically adds the US English dictionary. If you want other languages, the easiest option is simply to install one of TortoiseGit's language packs. This will install the appropriate dictionary files as well as the TortoiseGit local @@ -348,13 +348,12 @@ - Then just copy them to the bin sub-folder of - the TortoiseGit installation folder. Normally this will be - C:\Program Files\TortoiseGit\bin. - If you don't want to litter the bin sub-folder, - you can instead place your spell checker files in - C:\Program Files\TortoiseGit\Languages. If that folder isn't + Then just copy them into the %APPDATA%\TortoiseGit\dic folder. If that folder isn't there, you have to create it first. + TortoiseGit will also search the Languages sub-folder of + the TortoiseGit installation folder (normally this will be C:\Program Files\TortoiseGit\Languages); + this is the place where the language packs put their files. + However, the %APPDATA%-folder doesn't require administrator privileges and, thus, has higher priority. The next time you start TortoiseGit, the spell checker will be available. diff --git a/src/Changelog.txt b/src/Changelog.txt index a3d115c22..178f2763e 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -17,6 +17,9 @@ Released: unreleased * Fixed issue #2332: TortoiseGitMerge: Move "Create patch file" to the File menu * TortoiseGitMerge: Updated EditorConfig version to 0.12 * Fixed issue #2341: Jump to search box when pressing CTRL+E + * Custom dictionaries for the spell checker can now be put into the %APPDATA%\TortoiseGit\dic folder (w/o administrator privileges). + All other locations within the TortoiseGit installation folder (e.g. bin, dic, ...) except Languages are now deprecated. + See the manual for more information. == Bug Fixes == * Fixed issue #2260: Clicking in blank space in Commit dialog causes all unversioned files to become selected diff --git a/src/Utils/MiscUI/SciEdit.cpp b/src/Utils/MiscUI/SciEdit.cpp index a3eef3e51..827d15f25 100644 --- a/src/Utils/MiscUI/SciEdit.cpp +++ b/src/Utils/MiscUI/SciEdit.cpp @@ -278,6 +278,7 @@ BOOL CSciEdit::LoadDictionaries(LONG lLanguageID) TCHAR buf[6] = { 0 }; CString sFolder = CPathUtils::GetAppDirectory(); CString sFolderUp = CPathUtils::GetAppParentDirectory(); + CString sFolderAppData = CPathUtils::GetAppDataDirectory(); CString sFile; GetLocaleInfo(MAKELCID(lLanguageID, SORT_DEFAULT), LOCALE_SISO639LANGNAME, buf, _countof(buf)); @@ -289,7 +290,12 @@ BOOL CSciEdit::LoadDictionaries(LONG lLanguageID) sFile += buf; if (pChecker==NULL) { - if ((PathFileExists(sFolder + sFile + _T(".aff"))) && + if ((PathFileExists(sFolderAppData + _T("dic\\") + sFile + _T(".aff"))) && + (PathFileExists(sFolderAppData + _T("dic\\") + sFile + _T(".dic")))) + { + pChecker = new Hunspell(CStringA(sFolderAppData + _T("dic\\") + sFile + _T(".aff")), CStringA(sFolderAppData + _T("dic\\") + sFile + _T(".dic"))); + } + else if ((PathFileExists(sFolder + sFile + _T(".aff"))) && (PathFileExists(sFolder + sFile + _T(".dic")))) { pChecker = new Hunspell(CStringA(sFolder + sFile + _T(".aff")), CStringA(sFolder + sFile + _T(".dic"))); @@ -318,7 +324,12 @@ BOOL CSciEdit::LoadDictionaries(LONG lLanguageID) #if THESAURUS if (pThesaur==NULL) { - if ((PathFileExists(sFolder + _T("th_") + sFile + _T("_v2.idx"))) && + if ((PathFileExists(sFolderAppData + _T("th_") + sFile + _T("_v2.idx"))) && + (PathFileExists(sFolderAppData + _T("th_") + sFile + _T("_v2.dat")))) + { + pThesaur = new MyThes(CStringA(sFolderAppData + sFile + _T("_v2.idx")), CStringA(sFolderAppData + sFile + _T("_v2.dat"))); + } + else if ((PathFileExists(sFolder + _T("th_") + sFile + _T("_v2.idx"))) && (PathFileExists(sFolder + _T("th_") + sFile + _T("_v2.dat")))) { pThesaur = new MyThes(CStringA(sFolder + sFile + _T("_v2.idx")), CStringA(sFolder + sFile + _T("_v2.dat"))); -- 2.11.4.GIT