1234567891011121314151617181920212223242526272829 |
- import os
- base_dirs = [
- os.path.expanduser('~/.conda'),
- os.path.expanduser('~/.condarc'),
- os.path.expanduser('~/.continuum'),
- os.environ.get('CONDA_PREFIX', ''),
- os.path.join(os.environ.get('USERPROFILE', ''), '.conda'),
- os.path.join(os.environ.get('USERPROFILE', ''), 'AppData', 'Local', 'conda')
- ]
- def search_tilde_in_files(base_dir):
- for root, _, files in os.walk(base_dir):
- for file in files:
- try:
- filepath = os.path.join(root, file)
- with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
- content = f.read()
- if '~' in content:
- print(f"[!] Found '~' in: {filepath}")
- except Exception as e:
- pass
- print("Searching for '~' in Conda-related files...\n")
- for d in base_dirs:
- if d and os.path.exists(d):
- search_tilde_in_files(d)
- print("\nSearch complete.")
|