mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 11:40:18 +01:00
extmod/vfs_lfsx: Fix path handling in uos.stat() to consider cur dir.
This fixes the bug, that stat(filename) would not consider the current
working directory. So if e.g. the cwd is "lib", then stat("main.py") would
return the info for "/main.py" instead of "/lib/main.py".
This commit is contained in:
@@ -101,6 +101,14 @@ def test(bdev, vfs_class):
|
||||
print(vfs.getcwd())
|
||||
vfs.chdir("/testdir")
|
||||
print(vfs.getcwd())
|
||||
|
||||
# create file in directory to make sure paths are relative
|
||||
vfs.open("test2", "w").close()
|
||||
print(vfs.stat("test2"))
|
||||
print(vfs.stat("/testdir/test2"))
|
||||
vfs.remove("test2")
|
||||
|
||||
# chdir back to root and remove testdir
|
||||
vfs.chdir("/")
|
||||
print(vfs.getcwd())
|
||||
vfs.rmdir("testdir")
|
||||
|
||||
@@ -20,6 +20,8 @@ write 3
|
||||
[('test', 32768, 0, 8), ('testdir', 16384, 0, 0)]
|
||||
/
|
||||
/testdir
|
||||
(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
/
|
||||
test <class 'VfsLfs2'>
|
||||
(1024, 1024, 30, 28, 28, 0, 0, 0, 0, 255)
|
||||
@@ -43,4 +45,6 @@ write 3
|
||||
[('testdir', 16384, 0, 0), ('test', 32768, 0, 8)]
|
||||
/
|
||||
/testdir
|
||||
(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
(32768, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||
/
|
||||
|
||||
Reference in New Issue
Block a user