Skip to content

Commit 9bec806

Browse files
committed
Remove ensure method, as it's unrelated to AppDirs and because the Path.makedirs_p api basically implements the whole thing anyway.
1 parent 45f841e commit 9bec806

3 files changed

Lines changed: 1 addition & 20 deletions

File tree

‎CHANGES.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Changes
1313
'data'). For
1414
example, to create a config directory for "My App"::
1515

16-
config_dir = Path.appdirs("My App").user.config
16+
config_dir = Path.appdirs("My App").user.config.makedirs_p()
1717

1818
``config_dir`` will exist in a user context and will be in a
1919
suitable platform-friendly location.

‎path.py‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,13 +1501,6 @@ def get_dir(self, scope, class_):
15011501
MultiPath = Multi.for_class(self.path_class)
15021502
return MultiPath.detect(value)
15031503

1504-
@staticmethod
1505-
def ensure(target, *subs):
1506-
"""
1507-
Ensure target and any subpaths exist and return the resolved dir.
1508-
"""
1509-
return functools.reduce(operator.truediv, subs, target).makedirs_p()
1510-
15111504

15121505
class Multi:
15131506
"""

‎test_path.py‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -997,18 +997,6 @@ def test_property(self):
997997
assert isinstance(Path.app_dirs().user.data, Path)
998998
assert isinstance(Path.app_dirs().user.cache, Path)
999999

1000-
def test_ensure_simple(self, tmpdir):
1001-
target = Path(tmpdir / 'target')
1002-
res = AppDirPaths.ensure(target)
1003-
assert res == target
1004-
assert res.isdir()
1005-
1006-
def test_ensure_subdir(self, tmpdir):
1007-
target = Path(tmpdir / 'target')
1008-
res = AppDirPaths.ensure(target, 'sub1', 'sub2')
1009-
assert res == target / 'sub1' / 'sub2'
1010-
assert res.isdir()
1011-
10121000
def test_other_parameters(self):
10131001
"""
10141002
Other parameters should be passed through to appdirs function.

0 commit comments

Comments
 (0)