diff options
-rw-r--r-- | mesonbuild/modules/fs.py | 2 | ||||
-rw-r--r-- | test cases/common/227 fs module/meson.build | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index 254749d..ffb8e86 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.py @@ -32,7 +32,7 @@ class FSModule(ExtensionModule): def _check(self, check: str, state: 'ModuleState', args: typing.Sequence[str]) -> ModuleReturnValue: if len(args) != 1: MesonException('method takes exactly one argument.') - test_file = Path(state.source_root) / state.subdir / args[0] + test_file = Path(state.source_root) / state.subdir / Path(args[0]).expanduser() return ModuleReturnValue(getattr(test_file, check)(), []) @stringArgs diff --git a/test cases/common/227 fs module/meson.build b/test cases/common/227 fs module/meson.build index 515b3e2..30d193f 100644 --- a/test cases/common/227 fs module/meson.build +++ b/test cases/common/227 fs module/meson.build @@ -18,4 +18,7 @@ assert(fs.is_dir('subprojects'), 'Dir not detected correctly.') assert(not fs.is_dir('meson.build'), 'File detected as a dir.') assert(not fs.is_dir('nonexisting'), 'Bad path detected as a dir.') +assert(fs.is_dir('~'), 'expanduser not working') +assert(not fs.is_file('~'), 'expanduser not working') + subdir('subdir') |