Show More
@@ -172,8 +172,7 b' class HomeDirError(Exception):' | |||
|
172 | 172 | def get_home_dir(require_writable=False): |
|
173 | 173 | """Return the 'home' directory, as a unicode string. |
|
174 | 174 | |
|
175 | * First, check for frozen env in case of py2exe | |
|
176 | * Otherwise, defer to os.path.expanduser('~') | |
|
175 | Uses os.path.expanduser('~'), and checks for writability. | |
|
177 | 176 | |
|
178 | 177 | See stdlib docs for how this is determined. |
|
179 | 178 | $HOME is first priority on *ALL* platforms. |
@@ -189,19 +188,6 b' def get_home_dir(require_writable=False):' | |||
|
189 | 188 | The path is resolved, but it is not guaranteed to exist or be writable. |
|
190 | 189 | """ |
|
191 | 190 | |
|
192 | # first, check py2exe distribution root directory for _ipython. | |
|
193 | # This overrides all. Normally does not exist. | |
|
194 | ||
|
195 | if hasattr(sys, "frozen"): #Is frozen by py2exe | |
|
196 | if '\\library.zip\\' in IPython.__file__.lower():#libraries compressed to zip-file | |
|
197 | root, rest = IPython.__file__.lower().split('library.zip') | |
|
198 | else: | |
|
199 | root=os.path.join(os.path.split(IPython.__file__)[0],"../../") | |
|
200 | root=os.path.abspath(root).rstrip('\\') | |
|
201 | if _writable_dir(os.path.join(root, '_ipython')): | |
|
202 | os.environ["IPYKITROOT"] = root | |
|
203 | return py3compat.cast_unicode(root, fs_encoding) | |
|
204 | ||
|
205 | 191 | homedir = os.path.expanduser('~') |
|
206 | 192 | # Next line will make things work even when /home/ is a symlink to |
|
207 | 193 | # /usr/home as it is on FreeBSD, for example |
General Comments 0
You need to be logged in to leave comments.
Login now