aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-11-08 03:18:42 -0500
committerMichael Hirsch, Ph.D <scivision@users.noreply.github.com>2019-11-17 00:17:01 -0500
commit4adfd921ae9138dcbc1787e049529d1a923b6a97 (patch)
tree373a8ef0385c6e9d3f999597f0cdb74baa3b7097
parent9fc76b032348a71353555ab8d02f35415c0521bc (diff)
downloadmeson-4adfd921ae9138dcbc1787e049529d1a923b6a97.zip
meson-4adfd921ae9138dcbc1787e049529d1a923b6a97.tar.gz
meson-4adfd921ae9138dcbc1787e049529d1a923b6a97.tar.bz2
fs: use expanduser
-rw-r--r--mesonbuild/modules/fs.py2
-rw-r--r--test cases/common/227 fs module/meson.build3
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')