mirror of
https://github.com/vim/vim.git
synced 2025-11-15 23:14:06 -05:00
updated for version 7.3.1099
Problem: Python: Changing directory with os.chdir() causes problems for
Vim's notion of directories.
Solution: Add vim.chdir() and vim.fchdir(). (ZyX)
This commit is contained in:
@@ -788,6 +788,20 @@ EOF
|
||||
:$put =string(pyeval('dl2'))
|
||||
:$put =string(pyeval('df(2)'))
|
||||
:"
|
||||
:" Test chdir
|
||||
py << EOF
|
||||
import os
|
||||
fnamemodify = vim.Function('fnamemodify')
|
||||
cb.append(fnamemodify('.', ':p:h:t'))
|
||||
cb.append(vim.eval('@%'))
|
||||
os.chdir('..')
|
||||
cb.append(fnamemodify('.', ':p:h:t'))
|
||||
cb.append(vim.eval('@%').replace(os.path.sep, '/'))
|
||||
os.chdir('testdir')
|
||||
cb.append(fnamemodify('.', ':p:h:t'))
|
||||
cb.append(vim.eval('@%'))
|
||||
EOF
|
||||
:"
|
||||
:" Test errors
|
||||
:fun F() dict
|
||||
:endfun
|
||||
|
||||
@@ -429,6 +429,12 @@ abc'
|
||||
['a', 'b', 'c']
|
||||
[2, 2]
|
||||
[2, 2]
|
||||
testdir
|
||||
test86.in
|
||||
src
|
||||
testdir/test86.in
|
||||
testdir
|
||||
test86.in
|
||||
> Output
|
||||
>> OutputSetattr
|
||||
del sys.stdout.softspace:(<type 'exceptions.AttributeError'>, AttributeError("can't delete OutputObject attributes",))
|
||||
|
||||
@@ -748,6 +748,20 @@ EOF
|
||||
:$put =string(py3eval('dl2'))
|
||||
:$put =string(py3eval('df(2)'))
|
||||
:"
|
||||
:" Test chdir
|
||||
py3 << EOF
|
||||
import os
|
||||
fnamemodify = vim.Function('fnamemodify')
|
||||
cb.append(str(fnamemodify('.', ':p:h:t')))
|
||||
cb.append(vim.eval('@%'))
|
||||
os.chdir('..')
|
||||
cb.append(str(fnamemodify('.', ':p:h:t')))
|
||||
cb.append(vim.eval('@%').replace(os.path.sep, '/'))
|
||||
os.chdir('testdir')
|
||||
cb.append(str(fnamemodify('.', ':p:h:t')))
|
||||
cb.append(vim.eval('@%'))
|
||||
EOF
|
||||
:"
|
||||
:" Test errors
|
||||
:fun F() dict
|
||||
:endfun
|
||||
|
||||
@@ -418,6 +418,12 @@ abc'
|
||||
['a', 'b', 'c']
|
||||
[2, 2]
|
||||
[2, 2]
|
||||
b'testdir'
|
||||
test87.in
|
||||
b'src'
|
||||
testdir/test87.in
|
||||
b'testdir'
|
||||
test87.in
|
||||
> Output
|
||||
>> OutputSetattr
|
||||
del sys.stdout.softspace:(<class 'AttributeError'>, AttributeError("can't delete OutputObject attributes",))
|
||||
|
||||
Reference in New Issue
Block a user