diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2014-10-19 12:52:08 +0100 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2014-10-19 12:52:08 +0100 |
commit | 5c68f3db41766e24d5fe6f7adbfd713bc83786a3 (patch) | |
tree | 167e5a430857b842a20a79b8fb036180c23a13fc /setuptools/windows_support.py | |
parent | 7de0c4db65c320f233daf8de5f6004127f0dc979 (diff) | |
download | external_python_setuptools-5c68f3db41766e24d5fe6f7adbfd713bc83786a3.tar.gz external_python_setuptools-5c68f3db41766e24d5fe6f7adbfd713bc83786a3.tar.bz2 external_python_setuptools-5c68f3db41766e24d5fe6f7adbfd713bc83786a3.zip |
The name win32 is a misnomer. Use 'windows_support' instead.
Diffstat (limited to 'setuptools/windows_support.py')
-rw-r--r-- | setuptools/windows_support.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/setuptools/windows_support.py b/setuptools/windows_support.py new file mode 100644 index 00000000..fd373009 --- /dev/null +++ b/setuptools/windows_support.py @@ -0,0 +1,19 @@ +# From http://stackoverflow.com/questions/19622133/python-set-hide-attribute-on-folders-in-windows-os + +import ctypes + + +def hide_file(path): + """Sets the hidden attribute on a file or directory + + `path` must be unicode; be careful that you escape backslashes or use raw + string literals - e.g.: `u'G:\\Dir\\folder1'` or `ur'G:\Dir\folder1'`. + """ + + SetFileAttributesW = ctypes.windll.kernel32.SetFileAttributesW + + FILE_ATTRIBUTE_HIDDEN = 0x02 + + ret = SetFileAttributesW(path, FILE_ATTRIBUTE_HIDDEN) + if not ret: + raise ctypes.WinError() |