Message8251
I couldn't solve my chdir failure without doing this (almost) properly. Now on my local repo, I have a version that works better.
Jython 2.7b1+ (default:f553f6a07fb5+, Mar 9 2014, 09:29:38)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_45
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os, os.path, java.io
>>> os.getcwd()
'D:\\hg\\chdirtest'
>>> os.path.abspath('aa')
'D:\\hg\\chdirtest\\aa'
>>> os.path.abspath('d:aa')
'D:\\hg\\chdirtest\\aa'
>>> os.path.abspath('c:aa')
'c:\\Users\\Jeff\\Documents\\Eclipse\\jython-trunk\\dist\\aa'
>>> os.path.abspath('e:aa')
'e:\\test\\aa'
>>> os.path.abspath('c:\\aa')
'c:\\aa'
>>> sys.registry['user.dir']
u'D:\\hg\\chdirtest'
>>> os.chdir('e:')
>>> os.getcwd()
'e:\\test'
>>> sys.registry['user.dir']
u'D:\\hg\\chdirtest'
>>> os.chdir('c:..')
>>> os.getcwd()
'c:\\Users\\Jeff\\Documents\\Eclipse\\jython-trunk'
>>>
It does not, however, update the "real" current working directory on each drive, as CPython seems to. chdir only changes the CWD of the current PySystemState. The current directory of each drive remains what it was when Jython started. (In the presence of threads, this seems a safer idea anyway.) |
|
Date |
User |
Action |
Args |
2014-03-09 09:49:06 | jeff.allen | set | messageid: <1394358546.78.0.804803974309.issue2117@psf.upfronthosting.co.za> |
2014-03-09 09:49:06 | jeff.allen | set | recipients:
+ jeff.allen |
2014-03-09 09:49:06 | jeff.allen | link | issue2117 messages |
2014-03-09 09:49:05 | jeff.allen | create | |
|