diff --git a/python/ycm/utils.py b/python/ycm/utils.py index 0f36dca0..1e63f4f3 100644 --- a/python/ycm/utils.py +++ b/python/ycm/utils.py @@ -23,6 +23,7 @@ import sys import signal import functools import socket +import stat WIN_PYTHON27_PATH = 'C:\python27\pythonw.exe' WIN_PYTHON26_PATH = 'C:\python26\pythonw.exe' @@ -46,9 +47,20 @@ def PathToTempDir(): tempdir = os.path.join( tempfile.gettempdir(), 'ycm_temp' ) if not os.path.exists( tempdir ): os.makedirs( tempdir ) + # Needed to support multiple users working on the same machine; + # see issue 606. + MakeFolderAccessibleToAll( tempdir ) return tempdir +def MakeFolderAccessibleToAll( path_to_folder ): + current_stat = os.stat( path_to_folder ) + # readable, writable and executable by everyone + flags = ( current_stat.st_mode | stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH + | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP ) + os.chmod( path_to_folder, flags ) + + def GetUnusedLocalhostPort(): sock = socket.socket() # This tells the OS to give us any free port in the range [1024 - 65535]