(self)
| 196 | class 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 ([], []) |
no test coverage detected