Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/plugin/PluginSettings.cpp

Issue 10825021: Move settings page into the application directory (Closed)
Left Patch Set: Created June 3, 2013, 11:40 a.m.
Right Patch Set: Fixed nit and removed copying of html directory Created June 4, 2013, 9:15 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/plugin/PluginClass.cpp ('k') | src/plugin/PluginTabBase.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include <Wbemidl.h> 3 #include <Wbemidl.h>
4 #include <time.h> 4 #include <time.h>
5 #include "PluginIniFileW.h" 5 #include "PluginIniFileW.h"
6 #include "PluginIniFile.h" 6 #include "PluginIniFile.h"
7 #include "PluginSettings.h" 7 #include "PluginSettings.h"
8 #include "PluginDictionary.h" 8 #include "PluginDictionary.h"
9 #include "PluginClient.h" 9 #include "PluginClient.h"
10 #include "PluginChecksum.h" 10 #include "PluginChecksum.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 std::ifstream is; 97 std::ifstream is;
98 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in); 98 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in);
99 if (!is.is_open()) 99 if (!is.is_open())
100 { 100 {
101 TCHAR pf[MAX_PATH]; 101 TCHAR pf[MAX_PATH];
102 SHGetSpecialFolderPath( 102 SHGetSpecialFolderPath(
103 0, 103 0,
104 pf, 104 pf,
105 CSIDL_PROGRAM_FILESX86, 105 CSIDL_PROGRAM_FILESX86,
106 FALSE ); 106 FALSE );
107 //No files found, copy from the dll location
108 CString pathToDll;
109 DWORD pathResult = GetModuleFileNameW((HINSTANCE)&__ImageBase, pathToDll .GetBufferSetLength(MAX_PATH), MAX_PATH);
110 if (pathResult > 0)
111 {
112 CString cpyPath;
113 cpyPath = pathToDll.Left(pathToDll.ReverseFind('\\') + 1);
114
115 BOOL res = CopyFile(cpyPath + SETTINGS_INI_FILE, GetDataPath(SETTINGS_ INI_FILE), TRUE);
116 res = CopyFile(cpyPath + DICTIONARY_INI_FILE, GetDataPath(DICTIONARY_I NI_FILE), TRUE);
117 res = CopyFile(cpyPath + SETTING_PAGE_INI_FILE, GetDataPath(SETTING_PA GE_INI_FILE), TRUE);
118
119 SHFILEOPSTRUCT pFileStruct;
120 ZeroMemory(&pFileStruct, sizeof(SHFILEOPSTRUCT));
121 pFileStruct.hwnd = NULL;
122 pFileStruct.wFunc = FO_COPY;
123 WCHAR fromPath[MAX_PATH + 2];
124 WCHAR toPath[MAX_PATH + 2];
125
126 CString source = cpyPath + "html\\*";
127 wcscpy(fromPath, source);
128 fromPath[source.GetLength()] = '\0';
129 fromPath[source.GetLength() + 1] = '\0';
130
131 wcscpy(toPath, GetDataPath(L"html"));
132 toPath[GetDataPath(L"html").GetLength()] = '\0';
133 toPath[GetDataPath(L"html").GetLength() + 1] = '\0';
134
135 pFileStruct.pFrom = fromPath;
136 pFileStruct.pTo = toPath;
137 pFileStruct.fFlags = FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOCONFIRMM KDIR | FOF_NO_UI | FOF_RENAMEONCOLLISION;
138 SHFileOperation(&pFileStruct);
139 }
140 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in); 107 is.open(GetDataPath(SETTINGS_INI_FILE), std::ios_base::in);
141 if (!is.is_open()) 108 if (!is.is_open())
142 { 109 {
143 m_isDirty = true; 110 m_isDirty = true;
144 } 111 }
145 else 112 else
146 { 113 {
147 is.close(); 114 is.close();
148 isFileExisting = true; 115 isFileExisting = true;
149 116
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 return CString(L""); 1581 return CString(L"");
1615 } 1582 }
1616 1583
1617 1584
1618 void CPluginSettings::RefreshFilterlist() 1585 void CPluginSettings::RefreshFilterlist()
1619 { 1586 {
1620 CPluginClient::GetInstance()->UpdateAllSubscriptions(); 1587 CPluginClient::GetInstance()->UpdateAllSubscriptions();
1621 } 1588 }
1622 1589
1623 #endif // SUPPORT_WHITELIST 1590 #endif // SUPPORT_WHITELIST
LEFTRIGHT

Powered by Google App Engine
This is Rietveld