# Max path length (Windows 10 supports up to 260 traditionally) MAX_PATH_LENGTH = 260
def _has_write_permission(self, path: Path) -> bool: """Check write permissions on Windows 10""" try: # Test write permission test_file = path / ".write_test_temp" test_file.touch() test_file.unlink() return True except (PermissionError, OSError): return False installation directory windows 10
def require_admin_elevation(self, path: str) -> bool: """Check if admin elevation is needed for installation""" protected_dirs = [ "C:\\Program Files", "C:\\Program Files (x86)", "C:\\Windows", "C:\\System32" ] path_lower = path.lower() for protected in protected_dirs: if path_lower.startswith(protected.lower()): return not self._is_admin() return False # Max path length (Windows 10 supports up
def _get_default_paths(self) -> dict: """Get standard Windows 10 installation directories""" return InstallLocation.PROGRAM_FILES: os.environ.get("ProgramFiles", "C:\\Program Files"), InstallLocation.PROGRAM_FILES_X86: os.environ.get("ProgramFiles(x86)", "C:\\Program Files (x86)"), InstallLocation.LOCAL_APPDATA: os.environ.get("LOCALAPPDATA", "C:\\Users\\%USERNAME%\\AppData\\Local") path: Path) ->
def get_drive_free_space(self, path: str) -> int: """Get free space in bytes for the drive containing the path""" import shutil path_obj = Path(path) if not path_obj.exists(): path_obj = path_obj.parent total, used, free = shutil.disk_usage(path_obj) return free if name == " main ": manager = Windows10InstallationManager()
def _is_admin(self) -> bool: """Check if running with administrator privileges""" try: return ctypes.windll.shell32.IsUserAnAdmin() != 0 except: return False