Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(464)

Side by Side Diff: recipe_engine/third_party/setuptools/windows_support.py

Issue 1344583003: Recipe package system. (Closed) Base URL: git@github.com:luci/recipes-py.git@master
Patch Set: Recompiled proto Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « recipe_engine/third_party/setuptools/version.py ('k') | recipe_engine/types.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 import platform
2 import ctypes
3
4
5 def windows_only(func):
6 if platform.system() != 'Windows':
7 return lambda *args, **kwargs: None
8 return func
9
10
11 @windows_only
12 def hide_file(path):
13 """
14 Set the hidden attribute on a file or directory.
15
16 From http://stackoverflow.com/questions/19622133/
17
18 `path` must be text.
19 """
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()
OLDNEW
« no previous file with comments | « recipe_engine/third_party/setuptools/version.py ('k') | recipe_engine/types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698