Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c569799 authored by Sasha Smundak's avatar Sasha Smundak
Browse files

Fix rblf_file_exists, it should return true for a directory, too.

Fixes: 184278019
Test: internal
Change-Id: I68c3274a4540dd36e047d6c2027766dbe75d38f8
parent 4cc80241
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ func fileExists(_ *starlark.Thread, b *starlark.Builtin, args starlark.Tuple,
	if err := starlark.UnpackPositionalArgs(b.Name(), args, kwargs, 1, &path); err != nil {
		return starlark.None, err
	}
	if stat, err := os.Stat(path); err != nil || stat.IsDir() {
	if _, err := os.Stat(path); err != nil {
		return starlark.False, nil
	}
	return starlark.True, nil
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ load("assert.star", "assert")

def test():
    myname = "file_ops.star"
    assert.true(rblf_file_exists("."), "./ exists ")
    assert.true(rblf_file_exists(myname), "the file %s does exist" % myname)
    assert.true(not rblf_file_exists("no_such_file"), "the file no_such_file does not exist")
    files = rblf_wildcard("*.star")