MCPcopy
hub / github.com/blackboxo/CleanMyWechat / getAllPath

Method getAllPath

utils/selectVersion.py:198–245  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

196class selectVersion:
197
198 def getAllPath(self):
199 all_user_dirs = []
200 all_user_names = []
201 for path in find_all_wechat_paths():
202 dirs, names = get_dir_name(path)
203 all_user_dirs.extend(dirs)
204 all_user_names.extend(names)
205 if all_user_dirs:
206 return (all_user_dirs, all_user_names)
207
208 user = getpass.getuser()
209 candidates = [
210 os.path.join(r'C:\Users', user, 'Documents', 'WeChat Files'),
211 os.path.join(r'C:\Users', user, 'Documents', 'xwechat_files'),
212 os.path.join(r'C:\Users', user, 'Documents', 'XWechat Files'),
213 os.path.join(r'C:\Users', user, 'Documents', 'WXWork'),
214 os.path.join(r'C:\Users', 'Public', 'Documents', 'WXWork'),
215 os.path.join(r'C:\Users', user, 'AppData', 'Local', 'Packages', 'TencentWeChatLimited.forWindows10_sdtnhv12zgd7a', 'LocalCache', 'Roaming', 'Tencent', 'WeChatAppStore', 'WeChatAppStore Files'),
216 os.path.join(r'C:\Users', user, 'AppData', 'Local', 'Packages', 'TencentWeChatLimited.WeChatUWP_sdtnhv12zgd7a', 'LocalCache', 'Roaming', 'Tencent', 'WeChatAppStore', 'WeChatAppStore Files')
217 ]
218 appdata = os.environ.get('APPDATA')
219 if appdata:
220 candidates.extend([
221 os.path.join(appdata, 'Tencent', 'WeChat', 'WeChat Files'),
222 os.path.join(appdata, 'Tencent', 'WXWork'),
223 ])
224 localappdata = os.environ.get('LOCALAPPDATA')
225 if localappdata:
226 candidates.extend([
227 os.path.join(localappdata, 'Tencent', 'WeChat', 'WeChat Files'),
228 os.path.join(localappdata, 'Tencent', 'WXWork'),
229 ])
230
231 for path in candidates:
232 if os.path.exists(path):
233 result = get_dir_name(path)
234 if result[0]:
235 return result
236
237 registry_key_path = r"software\tencent\wechat"
238 value_name = "FileSavePath"
239 value = read_registry_value(registry_key_path, value_name)
240
241 if value and value != 'MyDocument:' and os.path.isdir(value):
242 fpath = os.path.join(value, 'WeChat Files')
243 return get_dir_name(fpath)
244 else:
245 return ([], [])

Callers 1

check_wechat_existsMethod · 0.80

Calls 3

find_all_wechat_pathsFunction · 0.85
get_dir_nameFunction · 0.85
read_registry_valueFunction · 0.85

Tested by

no test coverage detected