| OLD | NEW |
| 1 # Copyright (C) 2010 Google Inc. All rights reserved. | 1 # Copyright (C) 2010 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 | 41 |
| 42 def cygpath(path): | 42 def cygpath(path): |
| 43 """Converts an absolute cygwin path to an absolute Windows path.""" | 43 """Converts an absolute cygwin path to an absolute Windows path.""" |
| 44 return _CygPath.convert_using_singleton(path) | 44 return _CygPath.convert_using_singleton(path) |
| 45 | 45 |
| 46 | 46 |
| 47 # Note that this object is not threadsafe and must only be called | 47 # Note that this object is not threadsafe and must only be called |
| 48 # from multiple threads under protection of a lock (as is done in cygpath()) | 48 # from multiple threads under protection of a lock (as is done in cygpath()) |
| 49 class _CygPath(object): | 49 class _CygPath(object): |
| 50 |
| 50 """Manages a long-running 'cygpath' process for file conversion.""" | 51 """Manages a long-running 'cygpath' process for file conversion.""" |
| 51 _lock = None | 52 _lock = None |
| 52 _singleton = None | 53 _singleton = None |
| 53 | 54 |
| 54 @staticmethod | 55 @staticmethod |
| 55 def stop_cygpath_subprocess(): | 56 def stop_cygpath_subprocess(): |
| 56 if not _CygPath._lock: | 57 if not _CygPath._lock: |
| 57 return | 58 return |
| 58 | 59 |
| 59 with _CygPath._lock: | 60 with _CygPath._lock: |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 | 127 |
| 127 def _winpath_to_uri(path): | 128 def _winpath_to_uri(path): |
| 128 """Converts a window absolute path to a file: URL.""" | 129 """Converts a window absolute path to a file: URL.""" |
| 129 return "///" + path.replace("\\", "/") | 130 return "///" + path.replace("\\", "/") |
| 130 | 131 |
| 131 | 132 |
| 132 def _unixypath_to_uri(path): | 133 def _unixypath_to_uri(path): |
| 133 """Converts a unix-style path to a file: URL.""" | 134 """Converts a unix-style path to a file: URL.""" |
| 134 return "//" + path | 135 return "//" + path |
| OLD | NEW |