Show More
@@ -170,7 +170,6 b' def get_home_dir():' | |||
|
170 | 170 | raised for all other OSes. |
|
171 | 171 | """ |
|
172 | 172 | |
|
173 | isdir = _writable_dir | |
|
174 | 173 | env = os.environ |
|
175 | 174 | |
|
176 | 175 | # first, check py2exe distribution root directory for _ipython. |
@@ -182,7 +181,7 b' def get_home_dir():' | |||
|
182 | 181 | else: |
|
183 | 182 | root=os.path.join(os.path.split(IPython.__file__)[0],"../../") |
|
184 | 183 | root=os.path.abspath(root).rstrip('\\') |
|
185 |
if |
|
|
184 | if _writable_dir(os.path.join(root, '_ipython')): | |
|
186 | 185 | os.environ["IPYKITROOT"] = root |
|
187 | 186 | return _cast_unicode(root, fs_encoding) |
|
188 | 187 | |
@@ -216,7 +215,7 b' def get_home_dir():' | |||
|
216 | 215 | except KeyError: |
|
217 | 216 | pass |
|
218 | 217 | else: |
|
219 |
if |
|
|
218 | if _writable_dir(homedir): | |
|
220 | 219 | return _cast_unicode(homedir, fs_encoding) |
|
221 | 220 | |
|
222 | 221 | # Now look for a local home directory |
@@ -225,7 +224,7 b' def get_home_dir():' | |||
|
225 | 224 | except KeyError: |
|
226 | 225 | pass |
|
227 | 226 | else: |
|
228 |
if |
|
|
227 | if _writable_dir(homedir): | |
|
229 | 228 | return _cast_unicode(homedir, fs_encoding) |
|
230 | 229 | |
|
231 | 230 | # Now the users profile directory |
@@ -234,7 +233,7 b' def get_home_dir():' | |||
|
234 | 233 | except KeyError: |
|
235 | 234 | pass |
|
236 | 235 | else: |
|
237 |
if |
|
|
236 | if _writable_dir(homedir): | |
|
238 | 237 | return _cast_unicode(homedir, fs_encoding) |
|
239 | 238 | |
|
240 | 239 | # Use the registry to get the 'My Documents' folder. |
@@ -249,7 +248,7 b' def get_home_dir():' | |||
|
249 | 248 | except: |
|
250 | 249 | pass |
|
251 | 250 | else: |
|
252 |
if |
|
|
251 | if _writable_dir(homedir): | |
|
253 | 252 | return _cast_unicode(homedir, fs_encoding) |
|
254 | 253 | |
|
255 | 254 | # A user with a lot of unix tools in win32 may have defined $HOME. |
@@ -259,7 +258,7 b' def get_home_dir():' | |||
|
259 | 258 | except KeyError: |
|
260 | 259 | pass |
|
261 | 260 | else: |
|
262 |
if |
|
|
261 | if _writable_dir(homedir): | |
|
263 | 262 | return _cast_unicode(homedir, fs_encoding) |
|
264 | 263 | |
|
265 | 264 | # If all else fails, raise HomeDirError |
@@ -276,14 +275,13 b' def get_xdg_dir():' | |||
|
276 | 275 | This is only for posix (Linux,Unix,OS X, etc) systems. |
|
277 | 276 | """ |
|
278 | 277 | |
|
279 | isdir = _writable_dir | |
|
280 | 278 | env = os.environ |
|
281 | 279 | |
|
282 | 280 | if os.name == 'posix': |
|
283 | 281 | # Linux, Unix, AIX, OS X |
|
284 | 282 | # use ~/.config if not set OR empty |
|
285 | 283 | xdg = env.get("XDG_CONFIG_HOME", None) or os.path.join(get_home_dir(), '.config') |
|
286 |
if xdg and |
|
|
284 | if xdg and _writable_dir(xdg): | |
|
287 | 285 | return _cast_unicode(xdg, fs_encoding) |
|
288 | 286 | |
|
289 | 287 | return None |
@@ -298,7 +296,6 b' def get_ipython_dir():' | |||
|
298 | 296 | |
|
299 | 297 | env = os.environ |
|
300 | 298 | pjoin = os.path.join |
|
301 | isdir = _writable_dir | |
|
302 | 299 | |
|
303 | 300 | |
|
304 | 301 | ipdir_def = '.ipython' |
@@ -317,7 +314,7 b' def get_ipython_dir():' | |||
|
317 | 314 | |
|
318 | 315 | xdg_ipdir = pjoin(xdg_dir, xdg_def) |
|
319 | 316 | |
|
320 |
if |
|
|
317 | if _writable_dir(xdg_ipdir) or not _writable_dir(home_ipdir): | |
|
321 | 318 | ipdir = xdg_ipdir |
|
322 | 319 | |
|
323 | 320 | if ipdir is None: |
General Comments 0
You need to be logged in to leave comments.
Login now