Only use non-network drives for get_drives() in export.py
This commit is contained in:
@ -4,9 +4,10 @@
|
|||||||
from typing import Tuple, List, Generator, Dict, Any
|
from typing import Tuple, List, Generator, Dict, Any
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import string
|
import string
|
||||||
import datetime
|
import datetime
|
||||||
|
import ctypes
|
||||||
|
import ctypes.wintypes
|
||||||
import hashlib
|
import hashlib
|
||||||
import pypyodbc
|
import pypyodbc
|
||||||
|
|
||||||
@ -18,7 +19,11 @@ IGNORED_NAMES = ['Program Files', 'Program Files (x86)', 'AppData']
|
|||||||
|
|
||||||
|
|
||||||
def get_drives() -> List[str]:
|
def get_drives() -> List[str]:
|
||||||
return [d for d in string.ascii_uppercase if os.path.exists(f'{d}:')]
|
# only return local file systems
|
||||||
|
length = (ctypes.wintypes.DWORD * 1)()
|
||||||
|
mpr = ctypes.WinDLL('mpr')
|
||||||
|
return [d for d in string.ascii_uppercase
|
||||||
|
if os.path.exists(f'{d}:') and mpr.WNetGetConnectionW(f'{d}:', None, length) != 0xEA]
|
||||||
|
|
||||||
|
|
||||||
def search_accdb(base_path: str = None) -> Generator[str, None, None]:
|
def search_accdb(base_path: str = None) -> Generator[str, None, None]:
|
||||||
|
Reference in New Issue
Block a user