Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
keewenaw
GitHub Repository: keewenaw/ethereum-wallet-cracker
Path: blob/main/test/lib/python3.9/site-packages/setuptools/windows_support.py
4798 views
1
import platform
2
3
4
def windows_only(func):
5
if platform.system() != 'Windows':
6
return lambda *args, **kwargs: None
7
return func
8
9
10
@windows_only
11
def hide_file(path):
12
"""
13
Set the hidden attribute on a file or directory.
14
15
From http://stackoverflow.com/questions/19622133/
16
17
`path` must be text.
18
"""
19
import ctypes
20
__import__('ctypes.wintypes')
21
SetFileAttributes = ctypes.windll.kernel32.SetFileAttributesW
22
SetFileAttributes.argtypes = ctypes.wintypes.LPWSTR, ctypes.wintypes.DWORD
23
SetFileAttributes.restype = ctypes.wintypes.BOOL
24
25
FILE_ATTRIBUTE_HIDDEN = 0x02
26
27
ret = SetFileAttributes(path, FILE_ATTRIBUTE_HIDDEN)
28
if not ret:
29
raise ctypes.WinError()
30
31