##// END OF EJS Templates
check for writable dirs, not just existence, in utils.path...
MinRK -
Show More
@@ -41,6 +41,10 b' def _get_long_path_name(path):'
41 41 """Dummy no-op."""
42 42 return path
43 43
44 def _writable_dir(path):
45 """Whether `path` is a directory, to which the user has write access."""
46 return os.path.isdir(path) and os.access(path, os.W_OK)
47
44 48 if sys.platform == 'win32':
45 49 def _get_long_path_name(path):
46 50 """Get a long path name (expand ~) on Windows using ctypes.
@@ -166,7 +170,7 b' def get_home_dir():'
166 170 raised for all other OSes.
167 171 """
168 172
169 isdir = os.path.isdir
173 isdir = _writable_dir
170 174 env = os.environ
171 175
172 176 # first, check py2exe distribution root directory for _ipython.
@@ -272,7 +276,7 b' def get_xdg_dir():'
272 276 This is only for posix (Linux,Unix,OS X, etc) systems.
273 277 """
274 278
275 isdir = os.path.isdir
279 isdir = _writable_dir
276 280 env = os.environ
277 281
278 282 if os.name == 'posix':
@@ -294,7 +298,8 b' def get_ipython_dir():'
294 298
295 299 env = os.environ
296 300 pjoin = os.path.join
297 exists = os.path.exists
301 isdir = _writable_dir
302
298 303
299 304 ipdir_def = '.ipython'
300 305 xdg_def = 'ipython'
@@ -312,7 +317,7 b' def get_ipython_dir():'
312 317
313 318 xdg_ipdir = pjoin(xdg_dir, xdg_def)
314 319
315 if exists(xdg_ipdir) or not exists(home_ipdir):
320 if isdir(xdg_ipdir) or not isdir(home_ipdir):
316 321 ipdir = xdg_ipdir
317 322
318 323 if ipdir is None:
General Comments 0
You need to be logged in to leave comments. Login now