From 1bba4a38ccf3a87d138ad0563b72cc88410790f3 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Sun, 6 Oct 2013 18:27:47 -0700 Subject: [PATCH] Ensuring the temp dir exists before returning it --- python/ycm/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/ycm/utils.py b/python/ycm/utils.py index 72dfd268..ec63afc2 100644 --- a/python/ycm/utils.py +++ b/python/ycm/utils.py @@ -38,7 +38,10 @@ def ToUtf8IfNeeded( string_or_unicode ): def PathToTempDir(): - return os.path.join( tempfile.gettempdir(), 'ycm_temp' ) + tempdir = os.path.join( tempfile.gettempdir(), 'ycm_temp' ) + if not os.path.exists( tempdir ): + os.makedirs( tempdir ) + return tempdir # From here: http://stackoverflow.com/a/8536476/1672783