0
0
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:
Bram Moolenaar
2013-06-02 18:20:17 +02:00
parent 4f2109d782
commit f4258308e2
11 changed files with 194 additions and 31 deletions

View File

@@ -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

View File

@@ -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",))

View File

@@ -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

View File

@@ -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",))